Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public interface IMyInterface
- {
- void MyMethod(object arg);
- }
- public class MyClass1 : IMyInterface
- {
- public void MyMethod(object arg)
- {
- MyObject obj = (MyObject) arg;
- // do something with obj...
- }
- }
- public class MyClass2 : IMyInterface
- {
- public void MyMethod(object arg)
- {
- byte[] obj = (byte[]) arg;
- // do something with obj...
- }
- }
- public interface IMyInterface<T>
- {
- void MyMethod(T arg);
- }
- public class MyClass1 : IMyInterface<MyObject>
- {
- public void MyMethod(MyObject arg)
- {
- // typecast no longer necessary
- //MyObject obj = (MyObject) arg;
- // do something with arg...
- }
- }
- public class MyClass2 : IMyInterface<byte[]>
- {
- public void MyMethod(byte[] arg)
- {
- // typecast no longer necessary
- //byte[] obj = (byte[]) arg;
- // do something with arg...
- }
- }
- void Bla<T> (T a, T b);
Add Comment
Please, Sign In to add comment