.net - How to pass a value to a C# generic? -


in c++ templates have feature can pass value argument template of function. how can same in c#?

for instance, want similar following:

template <unsigned n> struct factorial {      enum {          result = n * factorial<n - 1>::result;      }; }; template <> struct factorial<0> {       enum {         result = 1;       }; }; 

but in c#. how can this?

by way, actual need them involves generating classes on demand (with few static values changed), presented code example.

c# generics not c++ templates in way. work types , not values.


Comments

Popular posts from this blog

java - JavaFX 2 slider labelFormatter not being used -

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -