Using System.Guid as type parameters for generic methods is not a problem, as the following code shows. Can you post the implementation of the MyGenericMethod method, as well as the code that calls this method?
class Program { static void Main(string[] args) { var test = new GenericTest(); test.MyGenericMethod(Guid.NewGuid()); } } class GenericTest { public void MyGenericMethod<T>(T t) { } }
I assume that the method implementation has a type constraint that requires the type parameter to be IConvertible, and therefore looks something like this:
class Program { static void Main(string[] args) { var test = new GenericTest(); test.MyGenericMethod(Guid.NewGuid()); } } class GenericTest { public void MyGenericMethod<T>(T t) where T : IConvertible { } }
source share