class Algo
{
public const long AlgorithmDescription = 1611048;
public const long AlgorithmFamilyCodeSequence = 6684719;
public const long AlgorithmName = 6684726;
public const long AlgorithmNameCodeSequence = 6684720;
public const long AlgorithmParameters = 6684722;
public const long AlgorithmType = 1611047;
public const long AlgorithmVersion = 6684721;
}
class Class1<T>
{
SortedList<uint, string> ds;
public SortedList<uint, string> TraverseTag()
{
ds = new SortedList<uint, string>();
uint i = 0;
foreach (FieldInfo prop in typeof(Algo).GetFields(BindingFlags.Public |
BindingFlags.Static |
BindingFlags.Instance))
{
ds.Add(i, prop.Name);
i++;
}
return ds;
}
}
public class Program
{
public static void Main()
{
var objClass = new Class1();
SortedList<uint, string> s = objClass.TraverseTag();
}
}
从Algo
类,我为此创建一个dll并使用对Program.cs
类的引用并调用TraverseTag()
方法,此方法返回uint,而FieldInfo返回给我{{ 1}}但我也希望在{[0,AlgorithmDescription]}
类中分配给我的数据成员的值。
例如&gt;
{[0,AlgorithmDescription,1611048]}