本文整理汇总了C#中DataType.IsPrimitiveType方法的典型用法代码示例。如果您正苦于以下问题:C# DataType.IsPrimitiveType方法的具体用法?C# DataType.IsPrimitiveType怎么用?C# DataType.IsPrimitiveType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataType
的用法示例。
在下文中一共展示了DataType.IsPrimitiveType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteObjectBody
protected override void WriteObjectBody(DataType dataType, object obj, SerializeType objSerializeType, uint objId)
{
if (dataType.IsPrimitiveType()) this.WritePrimitive(obj);
else if (dataType == DataType.Enum) this.WriteEnum(obj as Enum, objSerializeType);
else if (dataType == DataType.String) this.WriteString(obj as string);
else if (dataType == DataType.Struct) this.WriteStruct(obj, objSerializeType);
else if (dataType == DataType.ObjectRef) this.writer.Write(objId);
else if (dataType == DataType.Array) this.WriteArray(obj, objSerializeType, objId);
else if (dataType == DataType.Class) this.WriteStruct(obj, objSerializeType, objId);
else if (dataType == DataType.Delegate) this.WriteDelegate(obj, objSerializeType, objId);
else if (dataType.IsMemberInfoType()) this.WriteMemberInfo(obj, objId);
}
示例2: WriteObjectBody
protected override void WriteObjectBody(DataType dataType, object obj, SerializeType objSerializeType, uint objId)
{
if (dataType.IsPrimitiveType()) this.WritePrimitive((obj as PrimitiveNode).PrimitiveValue);
else if (dataType == DataType.String) this.writer.WriteString((obj as StringNode).StringValue);
else if (dataType == DataType.Enum) this.WriteEnum(obj as EnumNode);
else if (dataType == DataType.Struct) this.WriteStruct(obj as StructNode);
else if (dataType == DataType.ObjectRef) this.writer.WriteValue((obj as ObjectRefNode).ObjRefId);
else if (dataType == DataType.Array) this.WriteArray(obj as ArrayNode);
else if (dataType == DataType.Class) this.WriteStruct(obj as StructNode);
else if (dataType == DataType.Delegate) this.WriteDelegate(obj as DelegateNode);
else if (dataType.IsMemberInfoType()) this.WriteMemberInfo(obj as MemberInfoNode);
}
示例3: ReadObjectBody
protected override object ReadObjectBody(DataType dataType)
{
object result = null;
if (dataType.IsPrimitiveType()) result = this.ReadPrimitive(dataType);
else if (dataType == DataType.String) result = this.ReadString();
else if (dataType == DataType.Enum) result = this.ReadEnum();
else if (dataType == DataType.Struct) result = this.ReadStruct();
else if (dataType == DataType.ObjectRef) result = this.ReadObjectRef();
else if (dataType == DataType.Array) result = this.ReadArray();
else if (dataType == DataType.Class) result = this.ReadStruct();
else if (dataType == DataType.Delegate) result = this.ReadDelegate();
else if (dataType.IsMemberInfoType()) result = this.ReadMemberInfo(dataType);
return result;
}