Geeks With Blogs
Scott Wojan DotRant BLOG October 2008 Entries
Calling a Static Method on a Generic Class
I needed to be able to call a static method on a generic class today, so I thought I would post it up here to share with the world. Enjoy. //Our Generic Class public class SomeGenericClass<T> { public static char[] ConvertToCharArray(T something) { return something.ToString().ToChar... } } The example code: // Get the type of the generic class Type typeofClassWithGenericStati... = typeof(SomeGenericClass<... //Get a typed version of the generic type Type type = Type.GetType("System.String"); ......

Posted On Thursday, October 23, 2008 1:55 PM

Copyright © Scott Wojan | Powered by: