internal static void WriteClrTypeInfo(XmlWriterDelegator writer, Type dataContractType, SerializationBinder binder, SerializationInfo serInfo)
{
TypeInformation typeInformation = null;
string typeName = null;
string assemblyName = null;
if (binder != null)
{
binder.BindToName(dataContractType, out assemblyName, out typeName);
}
if (typeName == null)
{
if (serInfo.IsFullTypeNameSetExplicit)
{
typeName = serInfo.FullTypeName;
}
else
{
typeInformation = GetTypeInformation(serInfo.ObjectType);
typeName = typeInformation.FullTypeName;
}
}
if (assemblyName == null)
{
if (serInfo.IsAssemblyNameSetExplicit)
{
assemblyName = serInfo.AssemblyName;
}
else
{
assemblyName = (typeInformation == null) ? GetTypeInformation(serInfo.ObjectType).AssemblyString : typeInformation.AssemblyString;
}
}
WriteClrTypeInfo(writer, typeName, assemblyName);
}