Tuesday, October 30, 2007

Assembly References

In this post I'd like to point out one important mistake I noticed that many beginners of .NET do: They forget to create a reference to related the .NET assembly.
Even if you are preparing for an interview question or doing the actual programming, you have to know you need to create an assembly reference in .net so that your compiler can compile the program.

An example to this mistake: The programmer includes the below code to the top of the C# class file.

using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;

However, he/she forgets to tell the compiler where to find the actual assembly file (dll).
Correct the mistake by:
right click the solution, and click on "Add Reference".Select the System.Runtime.Remoting assembly in the list.This is like only telling someone to get sugar from Walmart.
How can that person know where Walmart is, if you don't tell him?!
Don't expect the person to guess or find out himself because the subject in question is NOT a person. He is a computer! And computers are stupid!

No comments: