Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualNypyren

Posted 05 April 2013 - 08:24 PM

The easiest way I know of to do this is how you're already doing it - access the static member via an instance. Every other possibility is a MUCH worse hack (static cross-construction, reflection, static table maintenance hell, etc).

I'm just hoping C# eventually supports static methods constraints - F# has something like this I believe:
// Member constraint with static member
type Class4<'T when 'T : (static member staticMethod1 : unit -> 'T) > =
    class end

#4Nypyren

Posted 05 April 2013 - 08:22 PM

The easiest way I know of to do this is how you're already doing it - access the static field via an instance. Every other possibility is a MUCH worse hack (static cross-construction, reflection, static table maintenance hell, etc).

I'm just hoping C# eventually supports static methods constraints - F# has something like this I believe:
// Member constraint with static member
type Class4<'T when 'T : (static member staticMethod1 : unit -> 'T) > =
    class end

#3Nypyren

Posted 05 April 2013 - 08:20 PM

The easiest way I know of to do this is how you're already doing it - access the static field via an instance. Every other possibility is a MUCH worse hack (static cross-construction, reflection, static table maintenance hell, etc).

I'm just hoping C# eventually supports static methods constraints - F# has something like this I believe.

#2Nypyren

Posted 05 April 2013 - 08:17 PM

The easiest way I know of to do this is how you're already doing it - access the static field via an instance. Every other possibility is a MUCH worse hack (static cross-construction, reflection, static table maintenance hell, etc).

I'm just hoping C# eventually supports static methods in interfaces (I have heard rumors that the underlying IL supports it, just not C#), which would make something like this possible.

#1Nypyren

Posted 05 April 2013 - 08:12 PM

The easiest way I know of to do this is how you're already doing it - access the static field via an instance. Every other possibility is a MUCH worse hack (static cross-construction, reflection, static table maintenance hell, etc).

PARTNERS