本文整理汇总了C#中StreamWriter.WriteSingle方法的典型用法代码示例。如果您正苦于以下问题:C# StreamWriter.WriteSingle方法的具体用法?C# StreamWriter.WriteSingle怎么用?C# StreamWriter.WriteSingle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StreamWriter
的用法示例。
在下文中一共展示了StreamWriter.WriteSingle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Serialize
public void Serialize(
StreamWriter streamWriter,
SerializationContext serializationContext,
object value,
PropertyMetaData propertyMetaData = null)
{
streamWriter.WriteSingle((short)value);
}
示例2: Serialize
public void Serialize(
StreamWriter streamWriter,
SerializationContext serializationContext,
object value,
PropertyMetaData propertyMetaData = null)
{ if (value == null)
{
return;
}
var ftinfo = value as FollowTargetInfo;
if (ftinfo != null)
{
streamWriter.WriteByte(ftinfo.FollowInfoType);
streamWriter.WriteByte(ftinfo.MoveType);
streamWriter.WriteInt32((int)ftinfo.Target.Type);
streamWriter.WriteInt32(ftinfo.Target.Instance);
streamWriter.WriteByte(ftinfo.Dummy);
streamWriter.WriteInt32(ftinfo.Dummy1);
streamWriter.WriteSingle(ftinfo.X);
streamWriter.WriteSingle(ftinfo.Y);
streamWriter.WriteSingle(ftinfo.Z);
}
var fcinfo = value as FollowCoordinateInfo;
if (fcinfo != null)
{
streamWriter.WriteByte(fcinfo.FollowInfoType);
streamWriter.WriteByte(fcinfo.MoveMode);
streamWriter.WriteByte(fcinfo.CoordinateCount);
streamWriter.WriteSingle(fcinfo.CurrentCoordinates.X);
streamWriter.WriteSingle(fcinfo.CurrentCoordinates.Y);
streamWriter.WriteSingle(fcinfo.CurrentCoordinates.Z);
streamWriter.WriteSingle(fcinfo.EndCoordinates.X);
streamWriter.WriteSingle(fcinfo.EndCoordinates.Y);
streamWriter.WriteSingle(fcinfo.EndCoordinates.Z);
}
}