Scott Wojan

DotRant BLOG
posts - 18, comments - 63, trackbacks - 5

My Links

News

Archives

Post Categories

Image Galleries

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");...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Thursday, October 23, 2008 1:55 PM | Feedback (0) |

Powered by: