Reputation: 836
Is it possible to shorten a namespace via a variable?
Example;
Instead of typing "System.Windows.MessageBox.Show("");
"
i am hoping to be able to make a variable to the location "system.windows" so i can do Variable.MessageBox("");
Upvotes: 0
Views: 57
Reputation: 77866
You can assign the namesspace variable like
using M = System.Windows;
M.MessageBox.Show("");
(OR)
Define a method of your own and call it like
public void Show(string s)
{
MessageBox.Show(s);
}
Now you can call it like
Show("something");
Upvotes: 2