Re: Build error in overloaded function



Hi Nick,

I am going to be calling the overloaded function from the form but never
using the parameter referenced in the external assembly. The form is always
going to use the string parameter. The function will be called with the other
parameter type in other projects and never in the form so why should a
reference to the external assembly be needed in the form. Also why does the
build error happen when i call the function and not when i create class with
the function.

-Vish



"Nicholas Paldino [.NET/C# MVP]" wrote:

> Vish,
>
> That's the thing though, it is going to use that type. Once you decide
> to call the overload that uses the type from the other assembly, the
> compiler needs the type information to make the call (not to mention the
> fact that you are probably going to create an instance of that type if you
> are going to pass it to an overload that expects it).
>
> So in the end, you have to set a reference to that assembly if you want
> to call that overload.
>
> Hope this helps.
>
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
>
> "Vish" <Vish@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:3380778A-01A4-4E5A-93FD-E0E6956016BA@xxxxxxxxxxxxxxxx
> > Hi all,
> >
> > I am having a build error in one of the overloaded functions in my class.
> > The function takes either a string as a parameter or a type referenced in
> > another dll as a parameter. My class references the dll where the type of
> > the
> > parameter is defined. I am able to create to create my class in a form
> > without any build errors and without any references to the DLL where the
> > other parameter type is defined. The form only uses the function with the
> > string parameter and not the other one. But when i try to call the
> > overloaded
> > function with a string parameter, i get an build error saying a reference
> > to
> > the DLL containing the other parameter type should be added to the form.
> >
> > I dont understand why the build error happens only when the function in my
> > class is called and not when it is created. Also i quite dont get why i
> > should add a reference in the form to the external parameter type when the
> > form is never gonna use it.
> >
> > If the question seems confusing i will be happy to give out more details.
> > Has anybody faced this kind of error before. I would appreciate it if
> > somebody can let me know if and how the above problem can be fixed.
> >
> > Thank You,
> > -Vish
>
>
>
.



Relevant Pages

  • Regarding copy constructors and mutators
    ... One thing that confused me about Perl (no matter how often I read ... "perldoc overload" page and in the Camel book explain that overloading ... as a reference to an object or as an actual copy of an object. ... time for another clarification: ...
    (comp.lang.perl.misc)
  • Re: Post-Increment and Pre-Increment Overloading
    ... For reference types, the reference to the operand is passed by value to the operator overload. ... But whether the original instance is modified or not depends on the overload method itself, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Build error in overloaded function
    ... are going to pass it to an overload that expects it). ... you have to set a reference to that assembly if you want ... > another dll as a parameter. ... > function with a string parameter, i get an build error saying a reference ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: null and overloading == operator
    ... Andrew Gniadek wrote: ... > reference to an object is null. ... because as soon as I overload it then i can't check for a null ... If replying to the group, please do not mail me too ...
    (microsoft.public.dotnet.languages.csharp)
  • VB FAQs (Interview Questions) lot lot
    ... Consider two objects, A and B. A holds a reference to B, ... Why do so many example programs not use the DLL name ... Private Declare Function SendMessage Lib "user32" ... Private Const BUFFER_LENGTH As Long = 255 ...
    (microsoft.public.dotnet.languages.vb)