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


C# ObjectWriter.WriteValue方法代码示例

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


在下文中一共展示了ObjectWriter.WriteValue方法的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 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

示例3: SerializeDocumentSnapshotInfo

        public void SerializeDocumentSnapshotInfo(DocumentChecksumObjectInfo info, ObjectWriter writer, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            SerializeDocumentId(info.Id, writer, cancellationToken);

            writer.WriteString(info.Name);
            writer.WriteValue(info.Folders.ToArray());
            writer.WriteInt32((int)info.SourceCodeKind);
            writer.WriteString(info.FilePath);
            writer.WriteBoolean(info.IsGenerated);
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:12,代码来源:Serializer_Asset.cs

示例4: WriteTo

            internal override void WriteTo(ObjectWriter writer)
            {
                base.WriteTo(writer);

                // PERF: Write the array out manually.Profiling shows that this is cheaper than converting to 
                // an array in order to use writer.WriteValue.
                writer.WriteInt32(this.children.Length);

                for (var i = 0; i < this.children.Length; i++)
                {
                    writer.WriteValue(this.children[i].Value);
                }
            }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:13,代码来源:SyntaxList.WithManyChildren.cs

示例5: WriteCompilationOptionsTo

        protected void WriteCompilationOptionsTo(CompilationOptions options, ObjectWriter writer, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            writer.WriteInt32((int)options.OutputKind);
            writer.WriteBoolean(options.ReportSuppressedDiagnostics);
            writer.WriteString(options.ModuleName);
            writer.WriteString(options.MainTypeName);
            writer.WriteString(options.ScriptClassName);
            writer.WriteInt32((int)options.OptimizationLevel);
            writer.WriteBoolean(options.CheckOverflow);

            // REVIEW: is it okay this being not part of snapshot?
            writer.WriteString(options.CryptoKeyContainer);
            writer.WriteString(options.CryptoKeyFile);

            writer.WriteValue(options.CryptoPublicKey.ToArray());
            writer.WriteBoolean(options.DelaySign.HasValue);
            if (options.DelaySign.HasValue)
            {
                writer.WriteBoolean(options.DelaySign.Value);
            }

            writer.WriteInt32((int)options.Platform);
            writer.WriteInt32((int)options.GeneralDiagnosticOption);

            writer.WriteInt32(options.WarningLevel);

            // REVIEW: I don't think there is a guarantee on ordering of elements in the immutable dictionary.
            //         unfortunately, we need to sort them to make it deterministic
            writer.WriteInt32(options.SpecificDiagnosticOptions.Count);
            foreach (var kv in options.SpecificDiagnosticOptions.OrderBy(o => o.Key))
            {
                writer.WriteString(kv.Key);
                writer.WriteInt32((int)kv.Value);
            }

            writer.WriteBoolean(options.ConcurrentBuild);
            writer.WriteBoolean(options.Deterministic);
            writer.WriteBoolean(options.PublicSign);

            // REVIEW: What should I do with these. we probably need to implement either out own one
            //         or somehow share these as service....
            //
            // XmlReferenceResolver xmlReferenceResolver
            // SourceReferenceResolver sourceReferenceResolver
            // MetadataReferenceResolver metadataReferenceResolver
            // AssemblyIdentityComparer assemblyIdentityComparer
            // StrongNameProvider strongNameProvider
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:50,代码来源:AbstractOptionsSerializationService.cs

示例6: WriteTo

        private unsafe void WriteTo(MetadataReader reader, ObjectWriter writer, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            var length = reader.MetadataLength;

            // TODO: any way to avoid allocating byte array here?
            var bytes = new byte[length];
            Marshal.Copy((IntPtr)reader.MetadataPointer, bytes, 0, length);

            writer.WriteValue(bytes);
        }
开发者ID:natidea,项目名称:roslyn,代码行数:12,代码来源:AbstractReferenceSerializationService.cs

示例7: WriteMvidTo

        private void WriteMvidTo(ModuleMetadata metadata, ObjectWriter writer, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            writer.WriteInt32((int)metadata.Kind);

            var metadataReader = metadata.GetMetadataReader();

            var mvidHandle = metadataReader.GetModuleDefinition().Mvid;
            var guid = metadataReader.GetGuid(mvidHandle);

            writer.WriteValue(guid.ToByteArray());
        }
开发者ID:natidea,项目名称:roslyn,代码行数:13,代码来源:AbstractReferenceSerializationService.cs

示例8: WriteTo

        protected virtual void WriteTo(ObjectWriter writer)
        {
            writer.WriteValue(_messageProvider);
            writer.WriteCompressedUInt((uint)_errorCode);
            writer.WriteInt32((int)_effectiveSeverity);
            writer.WriteInt32((int)_defaultSeverity);

            int count = (_arguments != null) ? _arguments.Length : 0;
            writer.WriteCompressedUInt((uint)count);

            if (count > 0)
            {
                foreach (var arg in _arguments)
                {
                    writer.WriteString(arg.ToString());
                }
            }
        }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:18,代码来源:DiagnosticInfo.cs

示例9: SerializeProjectReference

        public void SerializeProjectReference(ProjectReference reference, ObjectWriter writer, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            reference.ProjectId.WriteTo(writer);
            writer.WriteValue(reference.Aliases.ToArray());
            writer.WriteBoolean(reference.EmbedInteropTypes);
        }
开发者ID:jkotas,项目名称:roslyn,代码行数:8,代码来源:Serializer_Asset.cs

示例10: WriteTo

        internal virtual void WriteTo(ObjectWriter writer)
        {
            var kindBits = (UInt16)_kind;
            var hasDiagnostics = this.GetDiagnostics().Length > 0;
            var hasAnnotations = this.GetAnnotations().Length > 0;

            if (hasDiagnostics || hasAnnotations)
            {
                kindBits |= ExtendedSerializationInfoMask;
            }

            writer.WriteUInt16(kindBits);

            if (hasDiagnostics || hasAnnotations)
            {
                writer.WriteValue(hasDiagnostics ? this.GetDiagnostics() : null);
                writer.WriteValue(hasAnnotations ? this.GetAnnotations() : null);
            }
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:19,代码来源:GreenNode.cs

示例11: WriteTo

            public void WriteTo(ObjectWriter writer)
            {
                Id.WriteTo(writer);

                writer.WriteString(Name);
                writer.WriteValue(Folders.ToArray());
                writer.WriteInt32((int)SourceCodeKind);
                writer.WriteString(FilePath);
                writer.WriteBoolean(IsGenerated);
            }
开发者ID:jkotas,项目名称:roslyn,代码行数:10,代码来源:DocumentInfo.cs

示例12: WriteTo

        private void WriteTo(MetadataReader reader, ObjectWriter writer, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            var blockFieldInfo = reader.GetType().GetTypeInfo().GetDeclaredField("Block");
            var block = blockFieldInfo.GetValue(reader);

            // TODO: once things become public API, change it to copy stream over byte* and length from metadata reader
            var toArrayFieldInfo = block.GetType().GetTypeInfo().GetDeclaredMethod("ToArray");
            var array = (byte[])toArrayFieldInfo.Invoke(block, null);

            writer.WriteValue(array);
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:13,代码来源:AbstractReferenceSerializationService.cs

示例13: WriteTo

 internal override void WriteTo(ObjectWriter writer)
 {
     base.WriteTo(writer);
     writer.WriteValue(this.LeadingField);
     writer.WriteValue(this.TrailingField);
 }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:6,代码来源:SyntaxToken.SyntaxTokenWithTrivia.cs

示例14: WriteTo

 internal override void WriteTo(ObjectWriter writer)
 {
     base.WriteTo(writer);
     writer.WriteValue(_leading);
     writer.WriteValue(_trailing);
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:6,代码来源:SyntaxToken.SyntaxIdentifierWithTrivia.cs

示例15: SerializeDocumentId

        public static void SerializeDocumentId(DocumentId documentId, ObjectWriter writer, CancellationToken cancellationToken)
        {
            SerializeProjectId(documentId.ProjectId, writer, cancellationToken);

            writer.WriteValue(documentId.Id.ToByteArray());
            writer.WriteString(documentId.DebugName);
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:7,代码来源:Serializer_Asset.cs


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