当前位置: 首页>>代码示例>>C#>>正文


C# Utilities.ObjectWriter类代码示例

本文整理汇总了C#中Roslyn.Utilities.ObjectWriter的典型用法代码示例。如果您正苦于以下问题:C# ObjectWriter类的具体用法?C# ObjectWriter怎么用?C# ObjectWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ObjectWriter类属于Roslyn.Utilities命名空间,在下文中一共展示了ObjectWriter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteTo

 internal override void WriteTo(ObjectWriter writer)
 {
     base.WriteTo(writer);
     writer.WriteValue(_child0);
     writer.WriteValue(_child1);
     writer.WriteValue(_child2);
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:7,代码来源:SyntaxList.WithThreeChildren.cs

示例2: WriteTo

 public void WriteTo(ObjectWriter writer)
 {
     writer.WriteString(SerializationFormat);
     writer.WriteBoolean(_isCaseSensitive);
     writer.WriteInt32(_hashFunctionCount);
     _bitArray.WriteTo(writer);
 }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:7,代码来源:BloomFilter_Serialization.cs

示例3: SerializeChecksumObjectWithChildrenAsync

        public async Task SerializeChecksumObjectWithChildrenAsync(ChecksumObjectWithChildren checksumObject, ObjectWriter writer, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            writer.WriteString(checksumObject.Kind);
            checksumObject.Checksum.WriteTo(writer);

            writer.WriteInt32(checksumObject.Children.Length);
            foreach (var child in checksumObject.Children)
            {
                var checksum = child as Checksum;
                if (checksum != null)
                {
                    writer.WriteByte(ChecksumKind);
                    checksum.WriteTo(writer);
                    continue;
                }

                var checksumCollection = child as ChecksumCollection;
                if (checksumCollection != null)
                {
                    writer.WriteByte(ChecksumCollectionKind);
                    await SerializeChecksumObjectWithChildrenAsync(checksumCollection, writer, cancellationToken).ConfigureAwait(false);
                    continue;
                }

                throw ExceptionUtilities.UnexpectedValue(child);
            }
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:29,代码来源:Serializer_ChecksumObjectWithChildren.cs

示例4: WriteTo

 internal void WriteTo(ObjectWriter writer)
 {
     writer.WriteInt32(WordSpan.Start);
     writer.WriteInt32(WordSpan.Length);
     writer.WriteInt32(EdgeCount);
     writer.WriteInt32(FirstEdgeIndex);
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:7,代码来源:BKTree.Node.cs

示例5: WriteBitArray

        private static void WriteBitArray(ObjectWriter writer, BitArray bitArray)
        {
            // Our serialization format doesn't round-trip bit arrays of non-byte lengths
            Contract.ThrowIfTrue(bitArray.Length % 8 != 0);

            writer.WriteInt32(bitArray.Length / 8);

            // This will hold the byte that we will write out after we process every 8 bits. This is
            // LSB, so we push bits into it from the MSB.
            byte b = 0;

            for (var i = 0; i < bitArray.Length; i++)
            {
                if (bitArray[i])
                {
                    b = (byte)(0x80 | b >> 1);
                }
                else
                {
                    b >>= 1;
                }

                if ((i + 1) % 8 == 0)
                {
                    // End of a byte, write out the byte
                    writer.WriteByte(b);
                }
            }
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:29,代码来源:BloomFilter_Serialization.cs

示例6: WriteObjectToAsync

            public override async Task WriteObjectToAsync(ObjectWriter writer, CancellationToken cancellationToken)
            {
                var text = await _state.GetTextAsync(cancellationToken).ConfigureAwait(false);

                // TODO: make TextDocumentState to implement ISupportTemporaryStorage?
                _serializer.SerializeSourceText(_state.Storage as ITemporaryStorageWithName, text, writer, cancellationToken);
            }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:7,代码来源:SolutionAsset.cs

示例7: WriteTo

        private void WriteTo(Stream stream, ImmutableArray<DiagnosticData> items, CancellationToken cancellationToken)
        {
            using (var writer = new ObjectWriter(stream, cancellationToken: cancellationToken))
            {
                writer.WriteInt32(FormatVersion);

                AnalyzerVersion.WriteTo(writer);
                Version.WriteTo(writer);

                writer.WriteInt32(items.Length);

                foreach (var item in items)
                {
                    cancellationToken.ThrowIfCancellationRequested();

                    writer.WriteString(item.Id);
                    writer.WriteString(item.Category);

                    writer.WriteString(item.Message);
                    writer.WriteString(item.ENUMessageForBingSearch);
                    writer.WriteString(item.Title);
                    writer.WriteString(item.Description);
                    writer.WriteString(item.HelpLink);
                    writer.WriteInt32((int)item.Severity);
                    writer.WriteInt32((int)item.DefaultSeverity);
                    writer.WriteBoolean(item.IsEnabledByDefault);
                    writer.WriteBoolean(item.IsSuppressed);
                    writer.WriteInt32(item.WarningLevel);

                    if (item.HasTextSpan)
                    {
                        // document state
                        writer.WriteInt32(item.TextSpan.Start);
                        writer.WriteInt32(item.TextSpan.Length);
                    }
                    else
                    {
                        // project state
                        writer.WriteInt32(0);
                        writer.WriteInt32(0);
                    }

                    WriteTo(writer, item.DataLocation, cancellationToken);
                    WriteTo(writer, item.AdditionalLocations, cancellationToken);

                    writer.WriteInt32(item.CustomTags.Count);
                    foreach (var tag in item.CustomTags)
                    {
                        writer.WriteString(tag);
                    }

                    writer.WriteInt32(item.Properties.Count);
                    foreach (var property in item.Properties)
                    {
                        writer.WriteString(property.Key);
                        writer.WriteString(property.Value);
                    }
                }
            }
        }
开发者ID:RoryVL,项目名称:roslyn,代码行数:60,代码来源:DiagnosticDataSerializer.cs

示例8: SerializeChecksumWithChildren

        public void SerializeChecksumWithChildren(ChecksumWithChildren checksums, ObjectWriter writer, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            var kind = checksums.GetWellKnownSynchronizationKind();
            writer.WriteString(kind);
            checksums.Checksum.WriteTo(writer);

            writer.WriteInt32(checksums.Children.Count);
            foreach (var child in checksums.Children)
            {
                var checksum = child as Checksum;
                if (checksum != null)
                {
                    writer.WriteByte(ChecksumKind);
                    checksum.WriteTo(writer);
                    continue;
                }

                var checksumCollection = child as ChecksumCollection;
                if (checksumCollection != null)
                {
                    writer.WriteByte(ChecksumWithChildrenKind);
                    SerializeChecksumWithChildren(checksumCollection, writer, cancellationToken);
                    continue;
                }

                throw ExceptionUtilities.UnexpectedValue(child);
            }
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:30,代码来源:Serializer_ChecksumWithChildren.cs

示例9: WriteTo

        public override void WriteTo(OptionSet options, ObjectWriter writer, CancellationToken cancellationToken)
        {
            WriteOptionSetTo(options, LanguageNames.CSharp, writer, cancellationToken);

            WriteOptionTo(options, CSharpCodeStyleOptions.UseImplicitTypeForIntrinsicTypes, writer, cancellationToken);
            WriteOptionTo(options, CSharpCodeStyleOptions.UseImplicitTypeWhereApparent, writer, cancellationToken);
            WriteOptionTo(options, CSharpCodeStyleOptions.UseImplicitTypeWherePossible, writer, cancellationToken);
        }
开发者ID:orthoxerox,项目名称:roslyn,代码行数:8,代码来源:CSharpOptionsSerializationService.cs

示例10: WriteTo

 public void WriteTo(ObjectWriter writer)
 {
     writer.WriteInt32(DeclaredSymbolInfos.Length);
     foreach (var declaredSymbolInfo in DeclaredSymbolInfos)
     {
         declaredSymbolInfo.WriteTo(writer);
     }
 }
开发者ID:TyOverby,项目名称:roslyn,代码行数:8,代码来源:SyntaxTreeIndex.DeclarationInfo.cs

示例11: WriteTo

        public override void WriteTo(CompilationOptions options, ObjectWriter writer, CancellationToken cancellationToken)
        {
            WriteCompilationOptionsTo(options, writer, cancellationToken);

            var csharpOptions = (CSharpCompilationOptions)options;
            writer.WriteValue(csharpOptions.Usings.ToArray());
            writer.WriteBoolean(csharpOptions.AllowUnsafe);
        }
开发者ID:jkotas,项目名称:roslyn,代码行数:8,代码来源:CSharpOptionsSerializationService.cs

示例12: WriteTo

 public override void WriteTo(ObjectWriter writer)
 {
     writer.WriteInt32(DeclaredSymbolInfos.Count());
     foreach (var declaredSymbolInfo in DeclaredSymbolInfos)
     {
         declaredSymbolInfo.WriteTo(writer);
     }
 }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:8,代码来源:SyntaxTreeDeclarationInfo.cs

示例13: SerializeOptionSet

        // this is temporary solution until option is supported in compiler layer natively
        // this won't serialize all options but some we pre-selected
        public void SerializeOptionSet(OptionSet options, string language, ObjectWriter writer, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            writer.WriteString(language);

            var serializationService = GetOptionsSerializationService(language);
            serializationService.WriteTo(options, writer, cancellationToken);
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:11,代码来源:Serializer_OptionSet.cs

示例14: CreateChecksumFromStreamWriter

 private static Checksum CreateChecksumFromStreamWriter(string kind, Action<ObjectWriter, CancellationToken> writer)
 {
     using (var stream = SerializableBytes.CreateWritableStream())
     using (var objectWriter = new ObjectWriter(stream))
     {
         objectWriter.WriteString(kind);
         writer(objectWriter, CancellationToken.None);
         return Checksum.Create(stream);
     }
 }
开发者ID:otawfik-ms,项目名称:roslyn,代码行数:10,代码来源:CustomAsset.cs

示例15: WriteTo

 internal void WriteTo(ObjectWriter writer)
 {
     writer.WriteString(Name);
     writer.WriteString(ContainerDisplayName);
     writer.WriteString(FullyQualifiedContainerName);
     writer.WriteByte((byte)Kind);
     writer.WriteInt32(Span.Start);
     writer.WriteInt32(Span.Length);
     writer.WriteUInt16(ParameterCount);
     writer.WriteUInt16(TypeParameterCount);
 }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:11,代码来源:DeclaredSymbolInfo.cs


注:本文中的Roslyn.Utilities.ObjectWriter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。