Re: FileNotFoundException'

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



> My program really only knows the interface, but I need to reference the
> concrete class which is instantiated by the library ... odd, actually
> isn't it? What happens if the library is altered (or just confugured
> differently) and returns another type of object, but which still
> implements IDirectoryWatch? Do I need to recompile my program?

No, I don't think so - it isn't a compilation issue (thus why VS did not
catch it). Reflection is all at runtime, so if the library changes to
instantiate a class from some other DLL, that other DLL will have just need
to be in a place it can be located (aka: same directory, windows/system32,
etc).

If you have access to the library code, you might test that by writing up a
quick new library with a class that implements the interface and try to
instatiate it without recompiling your app. Better to be safe than sorry
later :)

--
Adam Clauss


.



Relevant Pages

  • Re: How to instantiate a class?
    ... of the dll, ... reflection to identify and then instantiate the class. ... the dll to implement an interface. ... To instantiate the proper class, you need to use reflection to search for the typein their DLL that implementyour interface, and then instantiate that type. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How to instantiate a class?
    ... of the dll, ... reflection to identify and then instantiate the class. ... the dll to implement an interface. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Conditional compilation in complex project hierarchy
    ... Since the interface doesn't change, no, you only need to recompile the one dll. ... I know I can create two build configurations for that sub- ...
    (microsoft.public.vc.language)
  • Re: How to instantiate a class?
    ... of the dll, ... reflection to identify and then instantiate the class. ... the dll to implement an interface. ... object obj = Activator.CreateInstance; ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Different versions of an interface
    ... > to instantiate an object of a specific type. ... > of an existing interface: ... > The COM dll is CAPICOM.dll. ... They are _declared_ to return ISigner references and you ...
    (comp.lang.pascal.delphi.misc)