internal static void NullableSerialize <valueType>(XmlSerializer xmlSerializer, Nullable <valueType> value) where valueType : struct { if (value.HasValue) { TypeSerializer <valueType> .StructSerialize(xmlSerializer, value.Value); } }
public void CallSerialize(Type value) { if (CheckPoint(value)) { TypeSerializer <AutoCSer.Reflection.RemoteType> .StructSerialize(this, new AutoCSer.Reflection.RemoteType(value)); } }
internal static void NullableSerialize <valueType>(JsonSerializer jsonSerializer, Nullable <valueType> value) where valueType : struct { if (value.HasValue) { TypeSerializer <valueType> .StructSerialize(jsonSerializer, value.Value); } else { jsonSerializer.CharStream.WriteJsonNull(); } }
/// <summary> /// 枚举集合转换 /// </summary> /// <param name="values">枚举集合</param> private void structStructEnumerable <valueType, elementType>(valueType values) where valueType : IEnumerable <elementType> { //charStream xmlStream = CharStream; string itemName = GetItemName(); fixed(char *itemNameFixed = itemName) { int itemNameLength = itemName.Length; foreach (elementType value in values) { nameStart(itemNameFixed, itemNameLength); TypeSerializer <elementType> .StructSerialize(this, value); nameEnd(itemNameFixed, itemNameLength); } } }
/// <summary> /// 数组转换 /// </summary> /// <param name="array">数组对象</param> private void structArray <valueType>(valueType[] array) { if (array != null && Push(array)) { //charStream xmlStream = CharStream; string itemName = GetItemName(); fixed(char *itemNameFixed = itemName) { int itemNameLength = itemName.Length; foreach (valueType value in array) { nameStart(itemNameFixed, itemNameLength); TypeSerializer <valueType> .StructSerialize(this, value); nameEnd(itemNameFixed, itemNameLength); } } Pop(); } }
internal static void StructSerialize <valueType>(JsonSerializer jsonSerializer, valueType value) { TypeSerializer <valueType> .StructSerialize(jsonSerializer, ref value); }
public void TypeSerialize <valueType>(ref valueType value) where valueType : struct { TypeSerializer <valueType> .StructSerialize(this, ref value); }
internal static void StructSerialize <valueType>(XmlSerializer xmlSerializer, valueType value) { TypeSerializer <valueType> .StructSerialize(xmlSerializer, value); }