Re: Windows.Forms controls dont seem to be able to use implicit conver

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On Sat, 29 Aug 2009 01:41:45 -0700, Zorgoban <re_f@xxxxxxxxx> wrote:

he describes the problem and the solution, but does not show that in the code he posted.

Unfortunately he describes a problem that doesnt exist.

He made a guess and described a problem that could in fact exist with the code you posted. Given the lack of a concise-but-complete code example that reliably demonstrates the problem, and the lack of a specific problem statement describing exactly what isn't working, I think he did a pretty good job.

Maybe he didn't answer the question you wanted, but that has not been at all clear from your previous posts.

I allready
mentioned, that my code works fine when I access it inside my own code
in the frontend application.

Yes, you did mention that whatever problem you had, it worked fine in one setting but not another. However, that information might as well not have been there because you never described the problem, nor provided examples of each setting relevant to your problem.

Just external assemblies, like
System.Forms or NHibernate dont seem to be able to see the
implementation of the operators.

Your original post never even used the word "operators". Even now, you are posting contradictory information. Your original post claimed an error at run-time, but operators are a compile-time construct.

Also implementation of IDisposable
doesnt fix this. To clarify my situation even more, another code
example. [...]

Until you post a concise-but-complete code example that reliably demonstrates the problem, along with a clear, specific description of the problem (including _exactly_ the text of any error messages, exceptions, etc. along with a specific statement as to when and where those messages, exceptions, etc. occur), it's unlikely that you will get an answer specifically useful to you.

The following code works perfectly in my app:

// our byte array. just fill it from the source of your choice
byte[] bytes;
// now we test the ImageBinary(byte[]) operator
ImageBinary imageBinary = bytes;
// now we test the Image(ImageBinary) operator
Image image = imageBinary;

Now lets assume that I have a business object with a property of type
ImageBinary. As soon as I bind this objects property to a grid views
column, I get the message that ImageBinary cant be converted to byte
[], wich is definitely wrong, since I implemented the implicit
operator.

If you are expecting your operator overloads to take effect in other code that isn't compiled with your own code, then that other code must be using reflection, and must have some specific rules you are required to follow in order for the overloading to be useful. Those rules would be specific to that other code though, and so you would have to consult a forum specific to the other code.

Greetings!
Zorgoban

PS: Here the exception to prove the problem is not inside the code of
the operator since it is never called.

System.InvalidCastException wurde nicht von Benutzercode behandelt.
Message="Das Objekt des Typs \"Questionnaire.Core.Base.ImageBinary\"
kann nicht in Typ \"System.Byte[]\" umgewandelt werden."

I don't speak or read German.

Pete
.



Relevant Pages

  • Re: Tasty exceptions
    ... C doesn't have exceptions, so there's no choice. ... True - C doesnt have exceptions. ... run without data loss. ... I think that illustrates that delphi style exception ...
    (borland.public.delphi.non-technical)
  • Re: TADOTable problem
    ... The error is bypassed if I turn stop on exceptions off in my try except ... I usuaully keep the feature on though. ... it doesnt happen outside the IDE ...
    (borland.public.delphi.database.ado)
  • Exception Handling
    ... suppose we just whant to blow up all exceptions that might occur to our ... caller method, when we call some another method.We do not want to do ... Doesnt it really do the same? ...
    (microsoft.public.dotnet.framework)