Geeks With Blogs
Keep It Simple Simple Solutions for Complex Scenarios September 2009 Entries
Extending Type class to get a type that implements an interface <IsImplementationOf>
Is really simple know if any type implements an interface in the traditional way we can use the “is” keyword to know if the class instance implements the interface, by instance Interface Code Snippet public interface IMarkable { void Mark(); } Class that implements the interface Code Snippet public class Marker : IMarkable { #region IMarkable Members public void Mark() { Console.Write("Do Mark!!"); } #endregion } Interface validation Code Snippet Marker marker = new Marker(); if (marker is IMarkable) ......

Posted On Wednesday, September 30, 2009 12:21 AM

Copyright © Juan Mestas J. (aka gotchas) | Powered by: