Show / Hide Table of Contents

MSDN.WhiteKnight - Stack Overflow answers

Ответ на "Динамически получить доступ к классу Resources"

Answer 906751

Link

Activator.CreateInstance не нужен, так как свойство статическое. Сделайте как-то так:

using System;
using System.Reflection;
using System.Linq;

// ...          

Assembly ass = Assembly.LoadFrom("путь к DLL");
TypeInfo t = ass.DefinedTypes.Where((x) => (x.Name == "Resources")).First();
PropertyInfo prop = t.DeclaredProperties.Where((x) => (x.Name == "hero3")).First();
var bitmap = (System.Drawing.Bitmap) prop.GetMethod.Invoke(null,new object[] { });

Content is retrieved from StackExchange API.

Auto-generated by ruso-archive tools.

Back to top Stack Overflow answers (published from sources in GitHub repository). Copyright (c) 2020, MSDN.WhiteKnight. Content licensed under BSD 3-Clause License.
Generated by DocFX