c# - 命名空间 'Numerics' 中不存在类型或命名空间名称 'System'

标签 c# mono

<分区>

我正在解决 problem 25Project Euler .我用 C# 为它编写了代码。但是在这种情况下,我需要使用“BigInt”,因为 Int64 不够大,无法容纳数字。但是,当我放置 using System.Numerics; 时,它会在编译期间给出错误消息(标题中的消息)。为什么是这样?我正在使用 Mono 2.10.9。

我的代码:

using System;
using System.Numerics;

public class Problem_25{
    static BigInt fib(int n){
        double Phi = (1+Math.Sqrt(5))/2;
        double phi = (1-Math.Sqrt(5))/2;
        BigInt an = Convert.BigInt((Math.Pow(Phi, n)-(Math.Pow(phi, n)))/Math.Sqrt(5));
        return an;
    }
    static void Main(){
        int i = 100;
        int answer = 0;
        string current_fn = "1";
        while(true){
            current_fn = Convert.ToString(fib(i));
            if(current_fn.Length == 1000){
                answer = i;
                break;
            }
            else{
                i++;
            }
        }
        Console.WriteLine("Answer: {0}", answer);
    }
}

最佳答案

您需要添加对 System.Numerics.dll 的引用。

关于c# - 命名空间 'Numerics' 中不存在类型或命名空间名称 'System',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18066882/

相关文章:

c# - 数据契约的序列化异常

c# - 您能否使用 Mono/LLVM 生成比使用 Microsoft 的 C# 编译器更快的 .NET 应用程序?

c# - vNext 类库中的目标 Android/iOS

.net - 跨平台桌面 GUI 的首选开发平台?

c# - DateTime 列上的 Mono InvalidOperationException (SQL Server)

c# - 生成错误 - Roslyn MSB3883 : Unexpected exception: System. IO.FileNotFoundException for System.Security.Principal.Windows

C# - 线程的行为是否可以像BackgroundWorkers (winForms) 一样?

c# - 使用保存到内存流的图像导出文件

android - 系统.Net.WebException : Error: NameResolutionFailure when Calling WCF Services throwing exception in mono android application

c# - 使用 Webinator+Selenium、SpecFlow 和 NUnit 的多浏览器测试