generics

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tony Johansson

    generics

    Hello!

    Is it possible to use generics property?

    /Tony


  • Peter Duniho

    #2
    Re: generics

    On Sat, 14 Jun 2008 02:59:07 -0700, Tony Johansson
    <johansson.ande rsson@telia.com wrote:
    Is it possible to use generics property?
    Well, that depends on what you mean by "generics property". But really,
    why don't you just try it?

    For more information, you may find this helpful:
    Learn about generics. Generic types maximize code reuse, type safety, and performance, and are commonly used to create collection classes.


    Pete

    Comment

    • Jon Skeet [C# MVP]

      #3
      Re: generics

      Tony Johansson <johansson.ande rsson@telia.com wrote:
      Is it possible to use generics property?
      You can't make a property generic in the same way that you can make a
      method generic, i.e. introduce a new type parameter.

      However, you *can* make a property of a type parameter, e.g in
      IEnumerator<Tth ere's the property:

      T Current { get; }

      --
      Jon Skeet - <skeet@pobox.co m>
      Web site: http://www.pobox.com/~skeet
      Blog: http://www.msmvps.com/jon.skeet
      C# in Depth: http://csharpindepth.com

      Comment

      Working...