do i need to add a reference to the assembly containing the input argument into a local method?

H

Hazzard

I have a method which takes a Token object as an argument in GetPassword
below.
Token.cs is a custom class in another assembly/namespace.
Do I need to add a reference to the assembly containing the Token class to
use an instance of that Token object passed in as an argument to the local
namespace/assembly as listed below?
(eg. using AssemblyContainingToken;)

namespace local
public class local
public local() //ctor
{
//
}
public string GetPassword(Token token)
{
Users getDBPassword = new Users();
if (token is A.B.UserNameToken)
{
statement;
}
}
}
thank you,
hazz
 
H

Hazzard

Thank you Sijin.
It does seems obvious that you would have to add a reference. How else would
the compiler know what that object is that is being used as an input
argument?
I was erroneously thinking about a runtime situation, where if this local
assembly were called from another, it would pass the Token along with the
call to GetPassword - why would the callee need to know this beforehand?
Academically I knew better. Intuitively, I am not far enough along where I
am thinking like a linker/compiler/build engine.
Thanks,
-Greg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top