Enum Builder
public static void CreateEnumForStudentType
(ModuleBuilder yourModuleBuilder)
{
EnumBuilder myEnumBuilder;
myEnumBuilder = yourModuleBuilder.DefineEnum
("DynamicDemo.StudentType", TypeAttributes.Public,
typeof(Int32));
FieldBuilder underGradField =
myEnumBuilder.DefineLiteral("Undergraduate", 1);
FieldBuilder gradField =
myEnumBuilder.DefineLiteral("Graduate", 2);
myEnumBuilder.CreateType();
}//End CreateEnumForStudent
(ModuleBuilder yourModuleBuilder)
{
EnumBuilder myEnumBuilder;
myEnumBuilder = yourModuleBuilder.DefineEnum
("DynamicDemo.StudentType", TypeAttributes.Public,
typeof(Int32));
FieldBuilder underGradField =
myEnumBuilder.DefineLiteral("Undergraduate", 1);
FieldBuilder gradField =
myEnumBuilder.DefineLiteral("Graduate", 2);
myEnumBuilder.CreateType();
}//End CreateEnumForStudent
0 Comments:
Post a Comment
<< Home