问题描述
当我使用python
时
我可以使用关键字替换库名
这是示例代码:
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()
根据此代码 将matplotlib.pyplot替换为plt的'as'关键字
我想在C#中使用此关键字as
- 在C#中是否有python的as关键字
解决方法
在c#中,“使用别名”;如果matplotlib.pyplot
是完全合格的.NET类型:
using plt = matplotlib.pyplot;
,
您可以使用以下命名空间/类作为别名:
using NsJson = Newtonsoft.Json;
public void MyMethod(){
new NsJson.Linq.JObject(); //example
}