public bool HasTypeSerializer(Type type) { if (type.IsValueType) { var hasSerializeMethod = ValueTypeSerializeMethods.GetMethodForType(type) != null; Debug.Assert(hasSerializeMethod == (ValueTypeDeserializeMethods.GetMethodForType(type) != null)); // <- debug check for matching deserializer return(hasSerializeMethod); } else { var hasSerializeMethod = ReferenceTypeSerializeMethods.GetMethodForType(type) != null; Debug.Assert(hasSerializeMethod == (ReferenceTypeDeserializeMethods.GetMethodForType(type) != null)); // <- debug check for matching deserializer return(hasSerializeMethod); } }
public ReferenceTypeSerializeMethod <T> GetReferenceTypeSerializeDelegate <T>() where T : class { return((ReferenceTypeSerializeMethod <T>)CreateDelegate(typeof(ReferenceTypeSerializeMethod <T>), ReferenceTypeSerializeMethods.GetMethodForType(typeof(T)))); }