我正在从名为Nethereum的c#库中使用BigHexIntegers。我需要使用BigHexIntegers将以太币添加到交易中并设置gas。但是,当我尝试使用这些变量类型时遇到一个问题,因为它认识到它是从Nethereum继承的变量,但是它告诉我我需要添加程序集:System.Runtime.Numerics。我在参考中寻找了该程序集,但找不到它(已添加的System.Numerics除外)。我在Nuget上找到了该软件包,并且已安装该软件包,但仍然无法作为参考。
难道这是一个完全不同的问题?
这是我的一些代码:
protected async void ethpobButton_Click(object sender, EventArgs e)
{
var gas = new HexBigInteger("60000");
var value = new HexBigInteger(ethAmountTextBox.Text);
var proofOfBurn = Reputation.GetFunction("burnCoins");
var result = await proofOfBurn.SendTransactionAsync(ethAddrTextBox.Text, gas ,value);
}
和
using System;
using NBitcoin;
using QBitNinja.Client;
using Nethereum.Hex.HexTypes;
错误信息:
Compiler Error Message: CS0012: The type 'BigInteger' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
最佳答案
您需要添加NuGet Nethereum.Hex(当您包含NuGet Nethereum.Web3时会自动包括在内。
然后添加,并使用以下代码将此添加到源代码文件中:using Nethereum.Hex.HexTypes;
。
关于c# - System.Runtime.Numerics BigHexInteger无法正常工作,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/39157310/