How To Test if a Type is Anonymous?
Posted
by DaveDev
on Stack Overflow
See other posts from Stack Overflow
or by DaveDev
Published on 2010-03-20T12:44:22Z
Indexed on
2010/03/20
12:51 UTC
Read the original article
Hit count: 296
Hi Guys
I have the following method which serialises an object to a HTML tag. I only want to do this though if the type isn't Anonymous.
private void MergeTypeDataToTag(object typeData)
{
if (typeData != null)
{
Type elementType = typeData.GetType();
if (/* elementType != AnonymousType */)
{
_tag.Attributes.Add("class", elementType.Name);
}
// do some more stuff
}
}
Can somebody show me how to achieve this?
Thanks
Dave
© Stack Overflow or respective owner