Given 1:
public abstract class BaseEntityViewModel<T> where T : RealmObject { public T SomeMethod()`; //какие-то проперти } public class SomeClass1 :RealmObject {} public class SomeClass2 :RealmObject {} Given 2:
IList<T> origObjList; //List<RealmObject> -- получаю его в рантайме IEnumerator<T> currObjList; // List<BaseEntityViewModel<SomeClass>> -- получаю его в рантайме So here are 2 questions right away:
How do I say something like:
((where have SomeMethod)currObjList).SomeMethod();That is, how can I tell the precompiler that I can call the
SomeMethod()method without directly specifying the type? (I just don’t know it in advance, but I cannot specify the parent class or interface) Even if I receive an object as a method, it doesn’t matter.I know that I can get from given2 a value of type
Тin runtime; How can I cast the result of the previous item in this T in rantayme? Considering that converting most likely will not work ... How do I record "(TypeSomeType) objectRez" whenTypeSomeTypeis stored in someTypeVariable
dynamic- Grundy