is there python's as keyword in C#

Viewed 129

when i used python
i could replace library name using as keyword

this is an example code:

import matplotlib.pyplot as plt

plt.rc('font', family = 'Malgun Gothic')
plt.title("title")
plt.plot(a, label = 'maximum degree', color = 'cyan', linestyle=':', marker = 'v')
plt.legend()
plt.show()

according to this code matplotlib.pyplot is replaced by 'as' keyword to plt

and i want use this keyword as in C#

  • is there python's as keyword in C#
2 Answers

in c#, "using alias"; if matplotlib.pyplot is a fully-qualified .NET type:

using plt = matplotlib.pyplot;

You can alias your using namespaces/classes like this:

using NsJson = Newtonsoft.Json;


public void MyMethod(){

    new NsJson.Linq.JObject(); //example

}
Related