static in attributes

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

    static in attributes

    In what condition attributes (class) might have static methods?


  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: static in attributes

    Pohihihi,

    Attributes can have static methods/properties, just like any other
    class. However, you have to remember that a static method/property on an
    attribute will not be applicable to the type, but rather, all types.

    Hope this helps.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - casperOne@caspe rshouse.com

    "Pohihihi" <pohihihi@hotma il.com> wrote in message
    news:u4TTnF%23t FHA.1136@TK2MSF TNGP12.phx.gbl. ..[color=blue]
    > In what condition attributes (class) might have static methods?
    >[/color]


    Comment

    • Pohihihi

      #3
      Re: static in attributes


      Actually I am not understanding what you mean by[color=blue]
      > attribute will not be applicable to the type, but rather, all types[/color]

      you mean it will behave like
      [AttributeUsage( AttributeTarget s.All)]

      ??

      Thanks,
      Po

      "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> wrote in
      message news:%23lZRIsAu FHA.3588@tk2msf tngp13.phx.gbl. ..[color=blue]
      > Pohihihi,
      >
      > Attributes can have static methods/properties, just like any other
      > class. However, you have to remember that a static method/property on an
      > attribute will not be applicable to the type, but rather, all types.
      >
      > Hope this helps.
      >
      >
      > --
      > - Nicholas Paldino [.NET/C# MVP]
      > - casperOne@caspe rshouse.com
      >
      > "Pohihihi" <pohihihi@hotma il.com> wrote in message
      > news:u4TTnF%23t FHA.1136@TK2MSF TNGP12.phx.gbl. ..[color=green]
      >> In what condition attributes (class) might have static methods?
      >>[/color]
      >
      >[/color]


      Comment

      Working...