Interfaced function returning type of implementing class?

If I understand your question correctly, your only choice without generics is to use reflection to do this.

You would have to do something like this: interface MyInterface { Type GetBaseType(); } But at that point it would be simpler to call instance.GetType() since that is what the implementation of this method would most likely look like. If by "type" you don't mean the reflected type but rather that you wish to be able to use the type from the interface statically at compilation time then you will need to make the interface generic.

Either You hard code the return type as MyClass You define the return type as MyInterface and then in the implementation of MyClass you can return a MyClass. The caller won't know what it's getting, but could use typeof to find out.

You achieve it like this: interface IUserService : IService then your class would be: class UserService : IUserService.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions