How to find out if a class is static?
Hello.
I have a IClassDeclaration (actually, ICSharpTypeDeclaration), and I would like to find out if it's a static class or not, howver, it seems that IsStatic always returns true (verified with Reflector - it seems that the concrete ClassDeclaration overrides IsStatic to always return true)
I came up with this:
(((ICSharpTypeDeclarationNode)typeDeclaration).ModifiersList.HasModifier(CSharpTokenType.STATIC_KEYWORD))
This works, but I was wondering if there's a better way.
Thanks a lot in advance,
Igal.
Please sign in to leave a comment.
Please note, that "static class" is C#-specific meaning.
Use CSharpDeclaredElementUtil.IsStaticClass method
--
Eugene Pasynkov
ReSharper Technical Lead
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"
"Igal Tabachnik" <no_reply@jetbrains.com> wrote in message
news:15298776.22921234004363034.JavaMail.clearspace@app4.labs.intellij.net...
>
>
>
>
>
>
>
>
>