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


C# ImmutableArray.ToArray方法代码示例

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


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

示例1: PublicKeyAddress

        public PublicKeyAddress(ImmutableArray<byte> publicKeyBytes)
        {
            this.publicKeyBytes = publicKeyBytes;

            var outputScript1 = new PayToPublicKeyBuilder().CreateOutput(publicKeyBytes.ToArray());
            var outputScript2 = new PayToPublicKeyHashBuilder().CreateOutputFromPublicKey(publicKeyBytes.ToArray());
            this.outputScript1Hash = new UInt256(SHA256Static.ComputeHash(outputScript1));
            this.outputScript2Hash = new UInt256(SHA256Static.ComputeHash(outputScript2));
        }
开发者ID:cole2295,项目名称:BitSharp,代码行数:9,代码来源:PublicKeyAddress.cs

示例2: NetworkAddressKey

        public NetworkAddressKey(ImmutableArray<byte> IPv6Address, UInt16 Port)
        {
            this.IPv6Address = IPv6Address;
            this.Port = Port;

            this._hashCode = Port.GetHashCode() ^ new BigInteger(IPv6Address.ToArray()).GetHashCode();
        }
开发者ID:cole2295,项目名称:BitSharp,代码行数:7,代码来源:NetworkAddressKey.cs

示例3: CreateAuthTicket

        public static ImmutableArray<byte> CreateAuthTicket(ImmutableArray<byte> token, IPAddress ip) {
            uint sessionSize = 4 + // unknown 1
                               4 + // unknown 2
                               4 + // external IP
                               4 + // filler
                               4 + // timestamp
                               4; // connection count
            
            MemoryStream stream = new MemoryStream();
            using (var writer = new BinaryWriter(stream)) {
                writer.Write(token.Length);
                writer.Write(token.ToArray());

                writer.Write(sessionSize);
                writer.Write(1);
                writer.Write(2);

                byte[] externalBytes = ip.GetAddressBytes();
                writer.Write(externalBytes.Reverse().ToArray());

                writer.Write((int) 0);
                writer.Write(2038 /* ms since connected to steam? */);
                writer.Write(1 /* connection count to steam? */);
            }

            return stream.ToArray().ToImmutableArray();
        }
开发者ID:hot1989hot,项目名称:nora,代码行数:27,代码来源:AuthTicket.cs

示例4: VerifyScript

        public static bool VerifyScript(ImmutableArray<byte> txBytes, ImmutableArray<byte> prevTxOutputPublicScriptBytes, int inputIndex, verify_flags_type flags)
        {
            //TODO
            if (!Environment.Is64BitProcess)
                return true;

            return verify_script(txBytes.ToArray(), (UIntPtr)txBytes.Length, prevTxOutputPublicScriptBytes.ToArray(), (UIntPtr)prevTxOutputPublicScriptBytes.Length, (uint)inputIndex, flags)
                == verify_result_type.verify_result_eval_true;
        }
开发者ID:cole2295,项目名称:BitSharp,代码行数:9,代码来源:LibbitcoinConsensus.cs

示例5: UncompressSlotMap

        private unsafe static ImmutableArray<LocalSlotDebugInfo> UncompressSlotMap(ImmutableArray<byte> compressedSlotMap)
        {
            if (compressedSlotMap.IsDefaultOrEmpty)
            {
                return default(ImmutableArray<LocalSlotDebugInfo>);
            }

            var mapBuilder = ArrayBuilder<LocalSlotDebugInfo>.GetInstance();
            int syntaxOffsetBaseline = -1;

            fixed (byte* compressedSlotMapPtr = &compressedSlotMap.ToArray()[0])
            {
                var blobReader = new BlobReader(compressedSlotMapPtr, compressedSlotMap.Length);
                while (blobReader.RemainingBytes > 0)
                {
                    byte b = blobReader.ReadByte();

                    if (b == SyntaxOffsetBaseline)
                    {
                        syntaxOffsetBaseline = -blobReader.ReadCompressedInteger();
                        continue;
                    }

                    if (b == 0)
                    {
                        // short-lived temp, no info
                        mapBuilder.Add(new LocalSlotDebugInfo(SynthesizedLocalKind.LoweringTemp, default(LocalDebugId)));
                        continue;
                    }

                    var kind = (SynthesizedLocalKind)((b & 0x3f) - 1);
                    bool hasOrdinal = (b & (1 << 7)) != 0;

                    int syntaxOffset;
                    if (!blobReader.TryReadCompressedInteger(out syntaxOffset))
                    {
                        // invalid data
                        return default(ImmutableArray<LocalSlotDebugInfo>);
                    }

                    syntaxOffset += syntaxOffsetBaseline;

                    int ordinal = 0;
                    if (hasOrdinal && !blobReader.TryReadCompressedInteger(out ordinal))
                    {
                        // invalid data
                        return default(ImmutableArray<LocalSlotDebugInfo>);
                    }

                    mapBuilder.Add(new LocalSlotDebugInfo(kind, new LocalDebugId(syntaxOffset, ordinal)));
                }
            }

            return mapBuilder.ToImmutableAndFree();
        }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:55,代码来源:EditAndContinueMethodDebugInformation.cs

示例6: LocalData

		public void LocalData( ImmutableArray<Type> sut, ImmutableArray<Assembly> assemblies )
		{
			var items = sut.ToArray();

			var expected = GetType().Adapt().WithNested().Concat( FormatterTypesAttribute.Types ).Fixed();
			Assert.Equal( expected.Length, items.Length );
			Assert.Equal( expected.OrderBy( type => type.FullName ), items.OrderBy( type => type.FullName ) );

			var actual = assemblies.ToArray().ToImmutableHashSet();
			Assert.Equal( expected.Assemblies().ToImmutableHashSet(), actual );
			Assert.Contains( GetType().Assembly, actual );
		}
开发者ID:DevelopersWin,项目名称:VoteReporter,代码行数:12,代码来源:ConventionBuilderTests.cs

示例7: UncompressSlotMap

        /// <exception cref="InvalidDataException">Invalid data.</exception>
        private unsafe static ImmutableArray<LocalSlotDebugInfo> UncompressSlotMap(ImmutableArray<byte> compressedSlotMap)
        {
            if (compressedSlotMap.IsDefaultOrEmpty)
            {
                return default(ImmutableArray<LocalSlotDebugInfo>);
            }

            var mapBuilder = ArrayBuilder<LocalSlotDebugInfo>.GetInstance();
            int syntaxOffsetBaseline = -1;

            fixed (byte* compressedSlotMapPtr = &compressedSlotMap.ToArray()[0])
            {
                var blobReader = new BlobReader(compressedSlotMapPtr, compressedSlotMap.Length);
                while (blobReader.RemainingBytes > 0)
                {
                    try
                    {
                        // Note: integer operations below can't overflow since compressed integers are in range [0, 0x20000000)

                        byte b = blobReader.ReadByte();

                        if (b == SyntaxOffsetBaseline)
                        {
                            syntaxOffsetBaseline = -blobReader.ReadCompressedInteger();
                            continue;
                        }

                        if (b == 0)
                        {
                            // short-lived temp, no info
                            mapBuilder.Add(new LocalSlotDebugInfo(SynthesizedLocalKind.LoweringTemp, default(LocalDebugId)));
                            continue;
                        }

                        var kind = (SynthesizedLocalKind)((b & 0x3f) - 1);
                        bool hasOrdinal = (b & (1 << 7)) != 0;

                        int syntaxOffset = blobReader.ReadCompressedInteger() + syntaxOffsetBaseline;

                        int ordinal = hasOrdinal ? blobReader.ReadCompressedInteger() : 0;

                        mapBuilder.Add(new LocalSlotDebugInfo(kind, new LocalDebugId(syntaxOffset, ordinal)));
                    }
                    catch (BadImageFormatException)
                    {
                        throw CreateInvalidDataException(compressedSlotMap, blobReader.Offset);
                    }
                }
            }

            return mapBuilder.ToImmutableAndFree();
        }
开发者ID:kangkot,项目名称:roslyn,代码行数:53,代码来源:EditAndContinueMethodDebugInformation.cs

示例8: Create

        internal static StrongNameKeys Create(ImmutableArray<byte> publicKey, CommonMessageProvider messageProvider)
        {
            Debug.Assert(!publicKey.IsDefaultOrEmpty);

            if (MetadataHelpers.IsValidPublicKey(publicKey))
            {
                return new StrongNameKeys(default(ImmutableArray<byte>), publicKey, null, null);
            }
            else
            {
                return new StrongNameKeys(messageProvider.CreateDiagnostic(messageProvider.ERR_BadCompilationOptionValue, Location.None,
                    nameof(CompilationOptions.CryptoPublicKey), BitConverter.ToString(publicKey.ToArray())));
            }
        }
开发者ID:daking2014,项目名称:roslyn,代码行数:14,代码来源:StrongNameKeys.cs

示例9: DiagnosticArguments

        public DiagnosticArguments(
            bool reportSuppressedDiagnostics,
            bool logAnalyzerExecutionTime,
            ProjectId projectId,
            ImmutableArray<byte[]> hostAnalyzerChecksums,
            string[] analyzerIds)
        {
            ReportSuppressedDiagnostics = reportSuppressedDiagnostics;
            LogAnalyzerExecutionTime = logAnalyzerExecutionTime;

            ProjectIdGuid = projectId.Id;
            ProjectIdDebugName = projectId.DebugName;

            HostAnalyzerChecksumsByteArray = hostAnalyzerChecksums.ToArray();
            AnalyzerIds = analyzerIds;
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:16,代码来源:DiagnosticArguments.cs

示例10: DiagnosticArguments

        public DiagnosticArguments(
            bool reportSuppressedDiagnostics,
            bool logAnalyzerExecutionTime,
            ProjectId projectId,
            Checksum optionSetChecksum,
            ImmutableArray<Checksum> hostAnalyzerChecksums,
            string[] analyzerIds)
        {
            ReportSuppressedDiagnostics = reportSuppressedDiagnostics;
            LogAnalyzerExecutionTime = logAnalyzerExecutionTime;

            ProjectId = projectId;

            OptionSetChecksum = optionSetChecksum;
            HostAnalyzerChecksums = hostAnalyzerChecksums.ToArray();
            AnalyzerIds = analyzerIds;
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:17,代码来源:DiagnosticArguments.cs

示例11: CreateServerTicket

        public static ImmutableArray<byte> CreateServerTicket(
                SteamID id, ImmutableArray<byte> auth, byte[] ownershipTicket) {
            long size = 8 + // steam ID
                        auth.Length +
                        4 + // length of ticket
                        ownershipTicket.Length;

            MemoryStream stream = new MemoryStream();
            using (var writer = new BinaryWriter(stream)) {
                writer.Write((ushort) size);
                writer.Write(id.ConvertToUInt64());

                writer.Write(auth.ToArray());

                writer.Write(ownershipTicket.Length);
                writer.Write(ownershipTicket);

                writer.Write(0);
            }

            return stream.ToArray().ToImmutableArray();
        }
开发者ID:hot1989hot,项目名称:nora,代码行数:22,代码来源:AuthTicket.cs

示例12: CastToBigInteger

 private BigInteger CastToBigInteger(ImmutableArray<byte> value)
 {
     return new BigInteger(value.ToArray());
 }
开发者ID:cole2295,项目名称:BitSharp,代码行数:4,代码来源:Stack.cs

示例13: CreateReader

 public static ISymUnmanagedReader CreateReader(ImmutableArray<byte> pdbImage, ImmutableArray<byte> peImageOpt = default(ImmutableArray<byte>))
 {
     return CreateReader(new MemoryStream(pdbImage.ToArray()), peImageOpt.IsDefault ? null : new MemoryStream(peImageOpt.ToArray()));
 }
开发者ID:JackWangCUMT,项目名称:roslyn,代码行数:4,代码来源:SymReaderFactory.cs

示例14: FormatSignature

 private unsafe string FormatSignature(ImmutableArray<byte> signature)
 {
     // TODO:
     // A null reference, the type is encoded in the signature. 
     // Ideally we would parse the signature and display the target type name. 
     // That requires MetadataReader vNext though.
     return BitConverter.ToString(signature.ToArray());
 }
开发者ID:daking2014,项目名称:roslyn,代码行数:8,代码来源:PdbToXml.cs

示例15: SetPathsAsync

 public async Task SetPathsAsync(ImmutableArray<string> referenceSearchPaths, ImmutableArray<string> sourceSearchPaths, string workingDirectory)
 {
     try
     {
         var result = await _interactiveHost.SetPathsAsync(referenceSearchPaths.ToArray(), sourceSearchPaths.ToArray(), workingDirectory).ConfigureAwait(false);
         UpdateResolvers(result);
     }
     catch (Exception e) when (FatalError.Report(e))
     {
         throw ExceptionUtilities.Unreachable;
     }
 }
开发者ID:MichalStrehovsky,项目名称:roslyn,代码行数:12,代码来源:InteractiveEvaluator.cs


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