Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#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