/
NLObP
/
AAEmu
Обзор
Документация
Войти
/
NLObP
/
AAEmu
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
AAEmu.Game/Utils/Scripts/ScriptObject.cs
24 строки
561 B
Roger Barreto
Performance + Refactoring + Code Style (#709)
16 сен 2023, 10:50
Не верифицирован
16 сен 2023, 10:50
0d89a74
Код
Авторство
О чём код?
using System; using System.Reflection; namespace AAEmu.Game.Utils.Scripts; public class ScriptObject { private readonly Type _type; private readonly object _instance; public string Name => _type.Namespace + "." + _type.Name; public ScriptObject(Type t, object o) { _type = t; _instance = o; } public object Invoke(string methodName) { var method = _type.GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public); return method != null ? method.Invoke(_instance, null) : null; } }