private int TouchAndWriteTypeIdWithFullStampInner(TypeDescriptor typeDescriptor) { if(typeDescriptor.UnderlyingType.IsGenericParameter) { writer.Write(typeDescriptor.UnderlyingType.GenericParameterPosition); writer.Write(true); return TouchAndWriteTypeIdWithFullStamp(typeDescriptor.UnderlyingType.DeclaringType); } else { int typeId; if(types.Dictionary.TryGetValue(typeDescriptor, out typeId)) { writer.Write(typeId); writer.Write(false); // generic-argument return typeId; } typeId = types.AddAndAdvanceId(typeDescriptor); writer.Write(typeId); writer.Write(false); // generic-argument typeDescriptor.Write(this); return typeId; } }
public static bool IsCollection(TypeDescriptor actualType) { return SpeciallySerializedCollectionsAQNs.Contains(actualType.Name); }