Closed luizfbicalho closed 8 months ago
I explained it the wrong way
I have a property that the type is Enum
List<Property> retorno = clas.Properties.Where(x=>x.Type.IsEnum).ToList();
And I want to get the Enum and the EnumValues from this property
something like
property.Type.ToEnum()
enum value in property is only known in runtime - not possible to do this
for filtering properties of type enum you need to define helper method
in top of template (where helper methods are defined) bool PropertyIsEnum(Property property) { return property.Type.IsEnum; }
and use it like this $Properties($PropertyIsEnum)[ // generate for each enum property ]
I dont want the actual value. I want tô list the enum possible values from the property type
you can't do this out of property - you can do this by annotating enum types as I already pasted - then you have fulll possibility to also grab all values
you can't do this out of property - you can do this by annotating enum types as I already pasted - then you have fulll possibility to also grab all values
that is my question, I needed to get the enum from the property type, if its not possible I'll try another way
copied from https://github.com/frhagn/Typewriter/issues/278 I have a class with properties, and I want to generate a method for each property that the type is enum, and access the enum values. How can I convert a type to a Enum?