How To Test if a Type is Anonymous?
- by DaveDev
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