Reflection | Рефлексия - Сценарии

Page / - Изменено Alexandr Fokin в 2024/09/30 14:14

Сценарии

Изменено Alexandr Fokin

в 2024/09/30 14:14

Оглавление

Поиск типа	Find Types in All Assemblies https://stackoverflow.com/questions/4692340/find-types-in-all-assemblies var assemblyQualifiedName = type.AssemblyQualifiedName; Type.GetType(assemblyQualifiedName, throwOnError: false)
Find a private field with Reflection? https://stackoverflow.com/questions/95910/find-a-private-field-with-reflection Using C# reflection to call a constructor https://stackoverflow.com/questions/3255697/using-c-sharp-reflection-to-call-a-constructor Invoke method by MethodInfo https://stackoverflow.com/questions/919826/invoke-method-by-methodinfo
Получение типа независимо от nullable	PropertyInfo prop; var type = Nullable.GetUnderlyingType(prop.PropertyType) ?? prop.PropertyType;
Формирование конкретного типа на основе Generic	Type.MakeGenericType https://learn.microsoft.com/ru-ru/dotnet/api/system.type.makegenerictype?view=net-7.0 C# Type MakeGenericType http://www.java2s.com/Tutorials/CSharp/System/Type/C_Type_MakeGenericType.htm