Python翻译为C#

问题描述:

我想将Python转换为C#。有一块我无法理解的Python代码。请指教。Python翻译为C#

AppList = { 
    "POLE" : set() 
} 

knownlist = AppList.get(ApplicationName.upper(),CardNumbers) 

// ApplicationName是一些字符串变量。

// CardNumbers是整数的集合。

这里是我的问题:

  1. 什么是APPLIST在这里,它是一个集合或C#某种属性的怎么样?

  2. AppList.get如何获取2个参数?这里的输出是什么?

+1

'AppList'是一个字典。 – cdarke

+1

请参阅['dict.get'](https://docs.python.org/3/library/stdtypes.html#dict.get)方法的文档。 –

什么是APPLIST在这里,它是一个集合或某种属性的像在C# ?

AppList是Python中的字典。

AppList.get如何获取2个参数?这里的输出是什么?

方法get()返回“ApplicationName.upper()”的值。如果“ApplicationName.upper()”不可用,则返回默认值即CardNumbers。

+0

谢谢。下面的代码意味着AppList字典包含一个名为“POLE”的项目。 AppList = { “POLE”:set() } –

+0

***是*** @Rahul B – anati