0
동일한 인터페이스가있는 클래스가 몇 개 있습니다. 메서드에 인터페이스를 전달합니다. 그 클래스가 통과하는 클래스를 얻으려고합니다. 예를 들어, 여기에 몇 가지 클래스는 내가있을 수 있습니다 무엇 내가 시도인터페이스에서 클래스 이름 가져 오기
public void ProcessClass(MyInterface myInterface)
:
여기internal class SomeClassName : MyInterface
internal class SomeOtherName : MyInterface
internal class NotReallySure: MyInterface
internal class NewClassName: MyInterface
internal class SomethingSpecial: MyInterface
는 방법? 나는 이것을 시도했지만 작동하지 않는다.
if (myInterface.GetType() == NotReallySure)
{
//
}
그래서 정확히 무엇을하려고 하는가?
내가 '하는 MyInterface'의 값이 특정 클래스 이름이나 더 나은 수준의 값
? http://stackoverflow.com/questions/3561202/check-if-instance-of-a-type – Marvin