Page 1 of 1

C# Assembly Reference

Posted: Sat Jun 04, 2022 11:27 pm
by geezzeer@gmail.com
A trivial C# program:

using System;
using System.IO;

public class HelloWorld {
static public void Main () {
Console.WriteLine ("Hello World!");
Streamreader sr = new Streamreader();
}
}
My program, above, results in the following error.

Compilation failed: 1 error(s), 0 warnings
main.cs(7,7): error CS0246: The type or namespace name `Streamreader' could not
be found. Are you missing an assembly reference

How does one add an assembly reference?

Re: C# Assembly Reference

Posted: Mon Jun 06, 2022 2:45 pm
by jpconver
Maybe you need to use: StreamReader instead of Streamreader

Re: C# Assembly Reference

Posted: Mon Jun 06, 2022 3:20 pm
by geezzeer@gmail.com
Thanks for the reply. A really basic mistake on my part.

I've made the correction: Streamreader to StreamReader in both cases.

Now the error is

Compilation failed: 1 error(s), 0 warnings
main.cs(7,19): error CS0122: `System.IO.StreamReader.StreamReader()' is inaccessible due to its protection level
/usr/lib/mono/4.5/mscorlib.dll (Location of the symbol related to previous error)

Further suggestions? Thanks in advance.

Re: C# Assembly Reference

Posted: Mon Jun 06, 2022 4:24 pm
by geezzeer@gmail.com
jpconver,

Please disregard my most recent reply/question. Immediately after submitting, I realized that streamreader has no constructor with zero arguments.

I'm having so much fun learning to use Browxy that I'm not thinking about the language.