private static void SetTextVariable_internal <T>(TextObject text, string tag, object variable) { Type textType = text.GetType(); if (textType == null) { InformationManager.DisplayMessage(new InformationMessage("ERROR: textType is null")); return; } MethodInfo setTextVariableMethod = textType.GetMethod("SetTextVariable", new Type[] { typeof(string), typeof(T) }); if (setTextVariableMethod == null) { InformationManager.DisplayMessage(new InformationMessage("ERROR: setTextVariableMethod is null")); return; } setTextVariableMethod.Invoke(text, new object[] { tag, variable }); }