Service Reference
Hi all, a beginner on C# here, I came this thing call 'Service Reference' many times. I looked up about it quite a few times but i couldn't understand what it exactly is. Is "using System.Windows.Form;" an example of a service reference? If not, can someone give me a layman explanation on what is service reference?

VulpesPosted Jan 15, 2015, 10:25 AM
This is not the same as what we mean when we say you need to 'add a reference' to your project. References in this context are any .NET or .COM dll which contains functionality which you want to use in your project.
For example, if you're writing a Windows Forms project, then you need to add a reference to System.Windows.Forms.dll which contains all the various classes used in such projects such as Form, Button, TextBox, ComboBox etc.
If you're creating such a project from Visual Studio, then a reference to this dll is automatically added to your project.
Also 'adding references' is distinct from 'importing namespaces' though the two often go 'hand in hand' with each other.
If you import a namespace with the 'using' directive, then this enables you to use any type in that namespace without the need to fully qualify it with its namespace.
So, if you have this:
using System.Windows.Forms;
you can refer to just a 'Form' in your project and not a 'System.Windows.Form' though the latter can always be used for clarity or to resolve an ambiguity where two imported namespaces contain classes with the same names.
Yi Rong TanPosted Jan 18, 2015, 12:43 AM