本文整理汇总了C#中IOutput.WriteNull方法的典型用法代码示例。如果您正苦于以下问题:C# IOutput.WriteNull方法的具体用法?C# IOutput.WriteNull怎么用?C# IOutput.WriteNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOutput
的用法示例。
在下文中一共展示了IOutput.WriteNull方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Write
/// <summary>
/// Writes an object to the specified output
/// </summary>
public void Write( IOutput output, object obj )
{
if ( obj == null )
{
output.WriteNull();
return;
}
Type objType = obj.GetType( );
if ( objType.IsArray )
{
output.Write( ( byte )TypeId.Array );
output.Write( ( Array )obj );
return;
}
switch ( objType.Name )
{
case "Type" :
output.Write( ( byte )TypeId.Type );
WriteType( output, ( Type )obj );
return;
case "Boolean" :
output.Write( ( byte )TypeId.Bool );
output.Write( ( Boolean )obj );
return;
case "Byte" :
output.Write( ( byte )TypeId.Byte );
output.Write( ( Byte )obj );
return;
case "SByte" :
output.Write( ( byte )TypeId.SByte );
output.Write( ( SByte )obj );
return;
case "Char" :
output.Write( ( byte )TypeId.Char );
output.Write( ( Char )obj );
return;
case "Int16" :
output.Write( ( byte )TypeId.Int16 );
output.Write( ( Int16 )obj );
return;
case "UInt16" :
output.Write( ( byte )TypeId.UInt16 );
output.Write( ( UInt16 )obj );
return;
case "Int32" :
output.Write( ( byte )TypeId.Int32 );
output.Write( ( Int32 )obj );
return;
case "UInt32" :
output.Write( ( byte )TypeId.UInt32 );
output.Write( ( UInt32 )obj );
return;
case "Int64" :
output.Write( ( byte )TypeId.Int64 );
output.Write( ( Int64 )obj );
return;
case "UInt64" :
output.Write( ( byte )TypeId.UInt64 );
output.Write( ( UInt64 )obj );
return;
case "Single" :
output.Write( ( byte )TypeId.Single );
output.Write( ( Single )obj );
return;
case "Double" :
output.Write( ( byte )TypeId.Double );
output.Write( ( Double )obj );
return;
case "Decimal" :
output.Write( ( byte )TypeId.Decimal );
output.Write( ( Decimal )obj );
return;
case "DateTime" :
output.Write( ( byte )TypeId.DateTime );
output.Write( ( DateTime )obj );
return;
case "String" :
output.Write( ( byte )TypeId.String );
output.Write( ( String )obj );
return;
}
//.........这里部分代码省略.........