Aaron Franke
Aaron Franke

Reputation: 4062

How do I use System.Numerics in Mono C# in MonoDevelop?

When I have this line at the top of my file:

using System.Numerics;

I get the following error:

Error CS0234: The type or namespace name 'Numerics' does not exist in the namespace 'System' (are you missing an assembly reference?) (CS0234) (CSharpTests)

Other using directives at the top of my file, such as using System;, work just fine.

I'm using Mono 5.12.0.301 and MonoDevelop 7.5 (build 1255) on Ubuntu 18.04 64-bit.

One of my first thoughts was that the framework version was set to something old enough to not have System.Numerics. In Options -> Build -> General, my framework version is the default of 4.5, and changing it to the latest version of 4.7.1 does not make the code work:

Framework Version Build General

This answer found that the problem was with an outdated framework version, but clearly I have a new enough framework version, right?

EDIT: Ok, with SushiHangover's answer I'm able to use System.Numerics, but I'm actually trying to use System.Numerics.Vectors, which I have included in References:

System Numerics Vectors

But when I use using System.Numerics.Vectors; I get this error:

Error CS0234: The type or namespace name 'Vectors' does not exist in the namespace 'System.Numerics' (are you missing an assembly reference?) (CS0234) (CSharpTests)

Upvotes: 2

Views: 1132

Answers (1)

SushiHangover
SushiHangover

Reputation: 74174

You need to add a manual reference to that assembly (and any others in the framework that you need to use, "System" is included by default)

Double click on the Projects "References" in the solution explorer:

enter image description here

Upvotes: 3

Related Questions