You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can't set value to FieldDefinition.Constant and FieldDefinition.HasConstant because it depends on the constant value inside of the assembly module.
privateTypeDefinitionCloneEnum(TypeDefinitiontype,ModuleDefinitiontarget){varbaseType=target.ImportReference(typeof(Enum));varnewEnum=newTypeDefinition(type.Namespace,type.Name,type.Attributes,baseType);Console.WriteLine(type.Name);foreach(varfintype.Fields){FieldDefinitionfield;if(!f.HasConstant)// value__{field=newFieldDefinition(f.Name,f.Attributes,target.TypeSystem.Int32);}else{field=newFieldDefinition(f.Name,f.Attributes,newEnum);// next two lines doesn't workfield.HasConstant=true;//still falsefield.Constant=f.Constant;// still null}newEnum.Fields.Add(field);}returnnewEnum;}
The result assembly contains the enums without any values.
And I'am really confused about this two properties:
The text was updated successfully, but these errors were encountered:
I can't set value to
FieldDefinition.Constant
andFieldDefinition.HasConstant
because it depends on the constant value inside of the assembly module.The result assembly contains the enums without any values.
And I'am really confused about this two properties:
The text was updated successfully, but these errors were encountered: