C# Assembly Reference

Do you have a compilation error or a difficult problem to solve? Ask for help here
Post Reply
geezzeer@gmail.com
Posts: 3
Joined: Fri Apr 08, 2022 12:10 am

C# Assembly Reference

Post by geezzeer@gmail.com » Sat Jun 04, 2022 11:27 pm

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?

jpconver
Site Admin
Posts: 10
Joined: Fri Dec 01, 2017 2:09 pm

Re: C# Assembly Reference

Post by jpconver » Mon Jun 06, 2022 2:45 pm

Maybe you need to use: StreamReader instead of Streamreader

geezzeer@gmail.com
Posts: 3
Joined: Fri Apr 08, 2022 12:10 am

Re: C# Assembly Reference

Post by geezzeer@gmail.com » Mon Jun 06, 2022 3:20 pm

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.

geezzeer@gmail.com
Posts: 3
Joined: Fri Apr 08, 2022 12:10 am

Re: C# Assembly Reference

Post by geezzeer@gmail.com » Mon Jun 06, 2022 4:24 pm

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.

Post Reply