本文整理汇总了C#中Orleans.Serialization.BinaryTokenStreamWriter.ReleaseBuffers方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryTokenStreamWriter.ReleaseBuffers方法的具体用法?C# BinaryTokenStreamWriter.ReleaseBuffers怎么用?C# BinaryTokenStreamWriter.ReleaseBuffers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orleans.Serialization.BinaryTokenStreamWriter
的用法示例。
在下文中一共展示了BinaryTokenStreamWriter.ReleaseBuffers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SerializeProperties
/// <summary>
/// Serializes event data properties
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
public static byte[] SerializeProperties(this EventData eventData)
{
var writeStream = new BinaryTokenStreamWriter();
SerializationManager.Serialize(eventData.Properties.Where(kvp => !SkipProperties.Contains(kvp.Key)).ToList(), writeStream);
var result = writeStream.ToByteArray();
writeStream.ReleaseBuffers();
return result;
}
示例2: GetTokenBytes
private static byte[] GetTokenBytes(StreamSequenceToken token)
{
var bodyStream = new BinaryTokenStreamWriter();
SerializationManager.Serialize(token, bodyStream);
var result = bodyStream.ToByteArray();
bodyStream.ReleaseBuffers();
return result;
}
示例3: DeepCopy
/// <summary>
/// Creates a deep copy of an object
/// </summary>
/// <param name="source">The source object to be copy</param>
/// <returns>The copy that was created</returns>
public object DeepCopy(object source)
{
if (source == null)
{
return null;
}
var writer = new BinaryTokenStreamWriter();
Serialize(source, writer, source.GetType());
var retVal = Deserialize(source.GetType(), new BinaryTokenStreamReader(writer.ToByteArray()));
writer.ReleaseBuffers();
return retVal;
}