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

  • Thread starter Thread starter Hazzard
  • Start date Start date
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
 
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
 
Back
Top