Re: Can't figure out this issue with Generics

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi Marc,

Great help, thanks so much. The warnings held the key! I've also modifed
the design per your suggestions and it seems to be working nicely now and I
learned something, always a good thing.

Take care,
Steve

"Marc Gravell" <marc.gravell@xxxxxxxxx> wrote in message
news:3131c6cd-7deb-4e4c-becd-37546a460c30@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
the types it says it can't covert are the SAME!
I'm stumped, anyone see the problem?

Different T... errors are one thing, but also look at the *warnings*:
Warning 1 Type parameter 'T' has the same name as the type parameter
from outer type 'EventShimWithArgs<T>' d:\dump\wf
\ConsoleApplication2\ConsoleApplication2\Program.cs 60 21
ConsoleApplication2
Warning 2 Type parameter 'T' has the same name as the type parameter
from outer type 'EventShimWithArgs<T>' d:\dump\wf
\ConsoleApplication2\ConsoleApplication2\Program.cs 67 8
ConsoleApplication2

So:
Rar<T> and Create<T> should perhaps not be generic methods, but just
members of the generic class?
i.e. Rar(object sender, EventArgs<T> eventArgs) etc

If you *need* them as generic methods inside the generic class, then
pick a different name for the arg, i.e.
i.e. Rar<TSomethingElse>(...)
(pick a meaningful name...)

Marc


.



Relevant Pages

  • Re: Generic abstract class
    ... public abstract class Entity: IMarconeEntity, ... If you have an abstract generic class with members that don't depend on the type parameter, you are probably better off making a non-generic base class with those members, and then another abstract generic class that inherits that non-generic base class. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Hide warning: "Generic classes may not be exposed to COM"
    ... are public members of a C# dll. ... If I mark the generic class as private I get a compiler error: ... warning: Type library exporter warning processing 'Utility.Array1D`1, ... Type library exporter encountered a generic type. ...
    (microsoft.public.dotnet.languages.csharp)
  • Referncing generic in XML comments
    ... A have a generic class - InfoCollection ... The code comment for my constructor is: ... I get a warning in the compilation saying that the comment has syntactically ...
    (microsoft.public.dotnet.framework)
  • Re: About Generics
    ... Whithin the generic class PrintableCollectionI must ... object that give me the possibility to actually store these Circles objects. ... should work fine (assuming you've used "T" as the generic type parameter for your own generic class, as you've shown in your post). ... Note that none of this has to do with the constraint you made for the type parameter. ...
    (microsoft.public.dotnet.languages.csharp)
  • sizeof(T) for C# 2.0 generic classes
    ... for a type parameter T in generic class cls. ... I need some generic way to covert ... T array to an array of bytes and conversely, ...
    (microsoft.public.dotnet.languages.csharp)