當前位置: 首頁>>代碼示例>>C#>>正文


C# BinaryTokenStreamWriter.ReleaseBuffers方法代碼示例

本文整理匯總了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;
 }
開發者ID:jdom,項目名稱:orleans,代碼行數:13,代碼來源:EventDataExtensions.cs

示例2: GetTokenBytes

 private static byte[] GetTokenBytes(StreamSequenceToken token)
 {
     var bodyStream = new BinaryTokenStreamWriter();
     SerializationManager.Serialize(token, bodyStream);
     var result = bodyStream.ToByteArray();
     bodyStream.ReleaseBuffers();
     return result;
 }
開發者ID:jdom,項目名稱:orleans,代碼行數:8,代碼來源:StreamDeliveryFailureEntity.cs

示例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;
        }
開發者ID:jdom,項目名稱:orleans,代碼行數:18,代碼來源:OrleansJsonSerializer.cs


注:本文中的Orleans.Serialization.BinaryTokenStreamWriter.ReleaseBuffers方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。