UnAnswered Challenge

How do i know if a class member is of type:

Enum,
Reference,
Primitive,
Array,

there is a enum property
CalculateMemberInfo().Value.Kind

which can have most of these values, but when iterating on all the
IClassMemberDeclarations whithin a class

the value is always "field" and not one of the more specific fields...



please help me on this..

thanks,

Guy.



1 comment
Comment actions Permalink


1) What is primitive type?
2) Which member are you speaking about? If it is field, then:

IType type = ((IField)member).Type;

then check if type is IArrayType, IPointerType, or IDeclaredType (builded
from class/struct/enum/delegate/interface + type arguments)

If type is IDeclaredType, then you can get it's type element:

ITypeElement typeElement = ((IDeclaredType)type).GetTypeElement();

then you can check the result typeElement for struct, enum, etc....


--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Ga" <t4m.productions@gmail.com> wrote in message
news:f9qbn4$fuh$1@is.intellij.net...

How do i know if a class member is of type:

>

Enum,
Reference,
Primitive,
Array,

>

there is a enum property
CalculateMemberInfo().Value.Kind

>

which can have most of these values, but when iterating on all the
IClassMemberDeclarations whithin a class

>

the value is always "field" and not one of the more specific fields...

>
>
>

please help me on this..

>

thanks,

>

Guy.

>
>



0

Please sign in to leave a comment.