속성 (MyProperty
)을 가진 객체 (MyObject
)가 있습니다. 유형 이름 (예 : String
또는 MyClass
등)을 받고 싶습니다.제네릭 (예 : "Collection`1")을 사용하는 속성의 객체 유형에서 "아포스트로피 + 숫자"의 의미는 무엇입니까?
PropertyInfo propInfo = typeof(MyObject).GetProperty("MyProperty");
Console.WriteLine(propInfo.PropertyType.Name);
Console.WriteLine(propInfo.PropertyType.FullName);
간단한 유형의 문제가 없습니다 만, MyProperty
는 제네릭 형식 인 경우, 나는 이름 (예를 들어, Collection<String>
)의지고의 문제를 직면 : 내가 사용합니다. 이는 인쇄 :
Collection`1
System.Collections.ObjectModel.Collection`1 [선택 System.String, mscorlib의 버전 2.0.0.0 = 문화 = 중립 PublicKeyToken = b77a5c561934e089]
을
무엇입니까? `1
? 그리고 "Collection<String>
"을 어떻게 얻을 수 있습니까?
Collection'1 1 개 제네릭 형식 매개 변수 –