private static bool IsAnonymousType(XmlAttributes a, string contextNs)
{
if (a.XmlType != null && a.XmlType.AnonymousType)
{
//
// check to see if the anonymous type is used in the original context
// only treat it as Anonymous, if the referencing element's namespace
// matches the original referencing element, otherwise revert to
// non-Anonymous handling for backward compatibility.
//
string originalNs = a.XmlType.Namespace;
return string.IsNullOrEmpty(originalNs) || originalNs == contextNs;
}
return false;
}