Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is there python's as keyword in C#

Tags:

python

c#

keyword

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#
like image 707
SoulSystem Avatar asked Dec 05 '25 06:12

SoulSystem


2 Answers

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

using plt = matplotlib.pyplot;
like image 149
Marc Gravell Avatar answered Dec 07 '25 19:12

Marc Gravell


You can alias your using namespaces/classes like this:

using NsJson = Newtonsoft.Json;


public void MyMethod(){

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

}
like image 20
Rithin Chalumuri Avatar answered Dec 07 '25 19:12

Rithin Chalumuri