c# - Unconstrained Melody error -


i installed nuget package jon skeet's unconstrained melody project, when attempt use it, error when compile:

type parameter 't' inherits conflicting constraints 'unconstrainedmelody.ienumconstraint' , 'system.valuetype'

function definition:

public void setenum<t>() t : struct, ienumconstraint {} 

am missing something? should not use nuget package?

i wrong, appears while library uses ienumconstraint internally, , gets work postbuild steps described in article, not provide magic consume ienumconstraint directly own methods.

the getvalues<t> method described in post 1 of several methods provided unconstrainedmelody.enums class. there other objects , methods available well.

if wanted constrain own generic methods enums, follow same steps jon used build library, on own library. there this example in comments of how postsharp.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -