code_junkie

Test if object implements interface

Nov 13th, 2011
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. if (object is IBlah)
  2.  
  3. IBlah myTest = originalObject as IBlah
  4.  
  5. if (myTest != null)
  6.  
  7. if( typeof(IMyInterface).IsAssignableFrom(someOtherType) )
  8. {
  9. }
  10.  
  11. if (obj is IMyInterface) {}
  12.  
  13. public static void BubbleSort<T>(ref IList<T> unsorted_list) where T : IComparable
  14. {
  15. //Some bubbly sorting
  16. }
  17.  
  18. MyInstace.GetType().GetInterfaces();
  19.  
  20. if (obj is IMyInterface)
  21.  
  22. if (obj.GetType() == typeof(IMyInterface))
Add Comment
Please, Sign In to add comment