public StackFrame(System.Diagnostics.StackFrame frame) : this() { Method = frame.GetMethod().ToString(); MethodType = frame.GetMethod().DeclaringType.ToString(); FileName = frame.GetFileName(); FileLine = frame.GetFileLineNumber(); FileColumn = frame.GetFileColumnNumber(); }
public static void Convert( System.Type conversionClass, Bam.Core.Settings settings, Bam.Core.Module module, VSSolutionBuilder.VSSettingsGroup vsSettingsGroup, string condition) { var moduleType = typeof(Bam.Core.Module); var vsSettingsGroupType = typeof(VSSolutionBuilder.VSSettingsGroup); var stringType = typeof(string); foreach (var i in settings.Interfaces()) { var method = conversionClass.GetMethod("Convert", new[] { i, moduleType, vsSettingsGroupType, stringType }); if (null == method) { throw new Bam.Core.Exception("Unable to locate method {0}.Convert({1}, {2}, {3})", conversionClass.ToString(), i.ToString(), moduleType, vsSettingsGroupType, stringType); } try { method.Invoke(null, new object[] { settings, module, vsSettingsGroup, condition }); } catch (System.Reflection.TargetInvocationException exception) { throw new Bam.Core.Exception(exception.InnerException, "VisualStudio conversion error:"); } } }
Convert( System.Type conversionClass, Bam.Core.Settings toolSettings, Bam.Core.StringArray commandLine) { var stringArrayType = typeof(Bam.Core.StringArray); foreach (var i in toolSettings.Interfaces()) { var method = conversionClass.GetMethod("Convert", new[] { i, stringArrayType }); if (null == method) { throw new Bam.Core.Exception("Unable to locate method {0}.Convert({1}, {2})", conversionClass.ToString(), i.ToString(), stringArrayType); } var commands = new Bam.Core.StringArray(); try { method.Invoke(null, new object[] { toolSettings, commands }); } catch (System.Reflection.TargetInvocationException exception) { throw new Bam.Core.Exception(exception.InnerException, "Command line conversion error:"); } commandLine.AddRange(commands); } }
/// <summary> /// Creates a SARIF StackFrame instance from a .NET StackFrame instance /// </summary> /// <param name="stackTrace"></param> /// <returns></returns> public static StackFrame Create(System.Diagnostics.StackFrame dotNetStackFrame) { // This value is -1 if not present int ilOffset = dotNetStackFrame.GetILOffset(); string fileName = dotNetStackFrame.GetFileName(); int nativeOffset = dotNetStackFrame.GetNativeOffset(); MethodBase methodBase = dotNetStackFrame.GetMethod(); Assembly assembly = methodBase?.DeclaringType.Assembly; string fullyQualifiedName = CreateFullyQualifiedName(methodBase); StackFrame stackFrame = new StackFrame { Module = assembly?.GetName().Name, FullyQualifiedLogicalName = fullyQualifiedName }; if (fileName != null) { stackFrame.Uri = new Uri(fileName); stackFrame.Line = dotNetStackFrame.GetFileLineNumber(); stackFrame.Column = dotNetStackFrame.GetFileColumnNumber(); } if (ilOffset != -1) { stackFrame.Offset = ilOffset; } if (nativeOffset != -1) { stackFrame.SetProperty("NativeOffset", nativeOffset.ToString(CultureInfo.InvariantCulture)); } return stackFrame; }
public static void Convert( System.Type conversionClass, Bam.Core.Settings toolSettings, Bam.Core.Module module, XcodeBuilder.Configuration configuration) { var moduleType = typeof(Bam.Core.Module); var xcodeConfigurationType = typeof(XcodeBuilder.Configuration); foreach (var i in toolSettings.Interfaces()) { var method = conversionClass.GetMethod("Convert", new[] { i, moduleType, xcodeConfigurationType }); if (null == method) { throw new Bam.Core.Exception("Unable to locate method {0}.Convert({1}, {2}, {3})", conversionClass.ToString(), i.ToString(), moduleType, xcodeConfigurationType); } try { method.Invoke(null, new object[] { toolSettings, module, configuration }); } catch (System.Reflection.TargetInvocationException exception) { throw new Bam.Core.Exception(exception.InnerException, "Xcode conversion error:"); } } }
static void AddMethodToLookup(System.Type type, SceneViewTool obj, string methodName, EventType eventType) { if (!methods.ContainsKey (eventType)) methods.Add (eventType, new List<MethodRef> ()); var method = type.GetMethod (methodName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); if (method != null) methods[eventType].Add (new MethodRef (obj, method)); }
///<summary> ///Executes a static method using reflection ///</summary> public static object executeMethod(System.Type t, string toExecute, object[] commands) { System.Reflection.MethodInfo methodInfo = t.GetMethod(toExecute); if (methodInfo == null) { return null; } return methodInfo.Invoke(null, commands); }
private static object RunMethod(System.Type t, string strMethod, object objInstance, BindingFlags eFlags, object[] aobjParams) { MethodInfo m = t.GetMethod(strMethod, eFlags); if (m == null) { throw new ArgumentException("There is no method '" + strMethod + "' for type '" + t.ToString() + "'."); } return m.Invoke(objInstance, aobjParams); }
void AddToHotNodeButton(System.Type t) { var tip = ""; var method = t.GetMethod("GetHelpText"); tip = (string)method.Invoke(null,null); var label = new GUIContent(t.Name, tip); if (GUILayout.Button (label, GUILayout.Width (100))) AddToHotNode (t); }
public static object RunMethod(System.Type t, string methodName, object objInstance, object[] objParams, BindingFlags eFlags) { MethodInfo m = t.GetMethod(methodName, eFlags); if (m == null) { throw new ArgumentException("There is no method '" + methodName + "' for type '" + t.ToString() + "'."); } object objRet = m.Invoke(objInstance, objParams); return objRet; }
/// <summary> /// Creates a <see cref="StackTrace"/> from the .NET system <see cref="System.Diagnostics.StackFrame"/> /// </summary> /// <param name="stackFrame"></param> /// <returns></returns> public static StackFrame Create(System.Diagnostics.StackFrame stackFrame) { MethodBase method = stackFrame.GetMethod(); Type declaringType = method.DeclaringType; // can be null for auto-generated expression trees string fullName = declaringType != null ? declaringType.FullName : null; return new StackFrame { ColumnNumber = stackFrame.GetFileColumnNumber(), FilePath = TryGetFileName(stackFrame), LineNumber = stackFrame.GetFileLineNumber(), ILOffset = stackFrame.GetILOffset(), MethodName = method.ToString(), TypeName = fullName }; }
public static object CallMethod(object target, System.Type type, string methodCMD) { string method_str = ""; string parasCMD = ""; object[] paras = null; method_str = methodCMD.Substring(0,methodCMD.IndexOf("(")); parasCMD = methodCMD.Substring(methodCMD.IndexOf("("), methodCMD.Length - methodCMD.IndexOf("(")); parasCMD = parasCMD.Substring( 1, parasCMD.Length - 2); if(!parasCMD .Equals( "" )){ if(parasCMD.Contains(",")){ string[] strParas = parasCMD.Split(','); paras = new object[strParas.Length]; for (int pos = 0; pos < strParas.Length; pos++) { // TODO loop in strParas // paras[pos] = int.Parse( strParas[pos] ); // if(strParas[pos].Contains("\"")){ // paras.SetValue(parasCMD.Replace("\"",""),pos); // } // // else // paras.SetValue(int.Parse(strParas[pos]),pos); paras.SetValue(GetParaFromString(strParas[pos]),pos); } }else{ paras = new object[1]; paras.SetValue(GetParaFromString(parasCMD),0); // if(parasCMD.Contains("\"")){ // parasCMD = parasCMD.Replace("\"",""); // paras.SetValue(parasCMD,0); //// paras.SetValue(parasCMD,0); // } // else // paras.SetValue(int.Parse(parasCMD),0); // paras[0] = int.Parse( parasCMD ); } } MethodInfo[] thods = type.GetMethods(); // MethodInfo method = type.GetMethod(method_str,System.Reflection.BindingFlags.); MethodInfo method = type.GetMethod(method_str); if( null == method){ XLogger.Log(target + " not have a " + method_str + " method." ); return null; } object returnValue = method.Invoke(target,paras); return returnValue; }
private static int GetGUITargetAttrValue(System.Type klass, string methodName) { MethodInfo method = klass.GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { object[] customAttributes = method.GetCustomAttributes(true); if (customAttributes != null) { for (int index = 0; index < customAttributes.Length; ++index) { if (customAttributes[index].GetType() == typeof (GUITargetAttribute)) return (customAttributes[index] as GUITargetAttribute).displayMask; } } } return -1; }
private static MethodInfo GetMethod(System.Type methodType, string methodName) { System.Type[] type = null; switch (methodName) { case "Contains": case "StartsWith": type = new System.Type[] { methodType }; break; case "ToLower": case "ToString": default: type = System.Type.EmptyTypes; break; } return methodType.GetMethod(methodName, type); }
private static MethodInfo GetMethodFromInterface(System.Type type, string methodName, System.Type[] parameterTypes) { const BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly; if (type == null) return null; MethodInfo method = type.GetMethod(methodName, flags, null, parameterTypes, null); if (method == null) { System.Type[] interfaces = type.GetInterfaces(); foreach (var @interface in interfaces) { method = GetMethodFromInterface(@interface, methodName, parameterTypes); if (method != null) return method; } } return method; }
private static object RunMethod(System.Type t, string strMethod, object objInstance, object[] aobjParams, BindingFlags eFlags) { MethodInfo m; try { m = t.GetMethod(strMethod, eFlags); if (m == null) { throw new ArgumentException("There is no method '" + strMethod + "' for type '" + t.ToString() + "'."); } object objRet = m.Invoke(objInstance, aobjParams); return objRet; } catch(Exception e) { throw e.InnerException; } }
private static object InvokeMethod(System.Type type, object objectInstance, string methodName, BindingFlags flags, params object[] args) { try { MethodInfo methodInfo = type.GetMethod(methodName, flags); if (methodInfo == null) { throw new ArgumentException("Type " + type.ToString() + " doesn't contains method " + methodName); } object objRet = methodInfo.Invoke(objectInstance, args); return objRet; } catch { throw; } }
/// <summary> /// Determine if the specified <see cref="System.Type"/> overrides the /// implementation of GetHashCode from <see cref="Object"/> /// </summary> /// <param name="clazz">The <see cref="System.Type"/> to reflect.</param> /// <returns><c>true</c> if any type in the hierarchy overrides GetHashCode().</returns> public static bool OverridesGetHashCode( System.Type clazz ) { try { MethodInfo getHashCode = clazz.GetMethod( "GetHashCode", new System.Type[0] ); if( getHashCode == null ) { return false; } else { // make sure that the DeclaringType is not System.Object - if that is the // declaring type then there is no override. return !getHashCode.DeclaringType.Equals( typeof( object ) ); } } catch( AmbiguousMatchException ) { // an ambigious match means that there is an override and it // can't determine which one to use. return true; } }
SharedSettings( System.Collections.Generic.IEnumerable<Bam.Core.Module> objectFiles, System.Type convertExtensionClassType, System.Type conversionInterfaceType, Bam.Core.TypeArray convertParameterTypes) { var sharedInterfaces = SharedInterfaces(objectFiles); var implementedInterfaces = new Bam.Core.TypeArray(sharedInterfaces); implementedInterfaces.Add(conversionInterfaceType); // define a new type, that contains just the shared interfaces between all object files // (any interface not shared, must be cloned later) var typeSignature = "IDESharedSettings"; var assemblyName = new System.Reflection.AssemblyName(typeSignature); var assemblyBuilder = System.AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName, System.Reflection.Emit.AssemblyBuilderAccess.Run); var moduleBuilder = assemblyBuilder.DefineDynamicModule("MainModule", true); var sharedSettingsTypeDefn = moduleBuilder.DefineType(typeSignature, System.Reflection.TypeAttributes.Public | System.Reflection.TypeAttributes.Class | System.Reflection.TypeAttributes.AutoClass | System.Reflection.TypeAttributes.AnsiClass | System.Reflection.TypeAttributes.BeforeFieldInit | System.Reflection.TypeAttributes.AutoLayout, typeof(C.SettingsBase), implementedInterfaces.ToArray()); // TODO: is this necessary? #if false sharedSettingsTypeDefn.DefineDefaultConstructor( System.Reflection.MethodAttributes.Public | System.Reflection.MethodAttributes.SpecialName | System.Reflection.MethodAttributes.RTSpecialName); #endif // implement 'automatic property' setter and getters for each property in each interface foreach (var i in sharedInterfaces) { var properties = i.GetProperties(); foreach (var prop in properties) { var dynamicProperty = sharedSettingsTypeDefn.DefineProperty(prop.Name, System.Reflection.PropertyAttributes.None, prop.PropertyType, System.Type.EmptyTypes); var field = sharedSettingsTypeDefn.DefineField("m" + prop.Name, prop.PropertyType, System.Reflection.FieldAttributes.Private); var methodAttrs = System.Reflection.MethodAttributes.Public | System.Reflection.MethodAttributes.HideBySig | System.Reflection.MethodAttributes.Virtual; if (prop.IsSpecialName) { methodAttrs |= System.Reflection.MethodAttributes.SpecialName; } var getter = sharedSettingsTypeDefn.DefineMethod("get_" + prop.Name, methodAttrs, prop.PropertyType, System.Type.EmptyTypes); var setter = sharedSettingsTypeDefn.DefineMethod("set_" + prop.Name, methodAttrs, null, new[] { prop.PropertyType }); var getIL = getter.GetILGenerator(); getIL.Emit(System.Reflection.Emit.OpCodes.Ldarg_0); getIL.Emit(System.Reflection.Emit.OpCodes.Ldfld, field); getIL.Emit(System.Reflection.Emit.OpCodes.Ret); dynamicProperty.SetGetMethod(getter); var setIL = setter.GetILGenerator(); setIL.Emit(System.Reflection.Emit.OpCodes.Ldarg_0); setIL.Emit(System.Reflection.Emit.OpCodes.Ldarg_1); setIL.Emit(System.Reflection.Emit.OpCodes.Stfld, field); setIL.Emit(System.Reflection.Emit.OpCodes.Ret); dynamicProperty.SetSetMethod(setter); } } var projectSettingsConvertMethod = sharedSettingsTypeDefn.DefineMethod("Convert", System.Reflection.MethodAttributes.Public | System.Reflection.MethodAttributes.Final | System.Reflection.MethodAttributes.HideBySig | System.Reflection.MethodAttributes.NewSlot | System.Reflection.MethodAttributes.Virtual, null, convertParameterTypes.ToArray()); var convertIL = projectSettingsConvertMethod.GetILGenerator(); foreach (var i in sharedInterfaces) { var extConvertParameterTypes = new Bam.Core.TypeArray(i); extConvertParameterTypes.AddRange(convertParameterTypes); var methInfo = convertExtensionClassType.GetMethod("Convert", extConvertParameterTypes.ToArray()); if (null == methInfo) { throw new Bam.Core.Exception("Unable to locate the function {0}.{1}(this {2})", convertExtensionClassType.FullName, "Convert", i.Name); } // TODO: can this be simplified, using the ldarg opcode? a simple loop would suffice convertIL.Emit(System.Reflection.Emit.OpCodes.Ldarg_0); if (extConvertParameterTypes.Count > 1) { convertIL.Emit(System.Reflection.Emit.OpCodes.Ldarg_1); } if (extConvertParameterTypes.Count > 2) { convertIL.Emit(System.Reflection.Emit.OpCodes.Ldarg_2); } if (extConvertParameterTypes.Count > 3) { convertIL.Emit(System.Reflection.Emit.OpCodes.Ldarg_3); } convertIL.Emit(System.Reflection.Emit.OpCodes.Call, methInfo); } convertIL.Emit(System.Reflection.Emit.OpCodes.Ret); var sharedSettingsType = sharedSettingsTypeDefn.CreateType(); var attributeType = typeof(Bam.Core.SettingsExtensionsAttribute); // now that we have an instance of the shared settings type, calculate the values of the individual settings across all object files // for all shared interfaces var commonSettings = System.Activator.CreateInstance(sharedSettingsType) as SettingsBase; commonSettings.InitializeAllInterfaces(objectFiles.First(), true, false); foreach (var i in sharedInterfaces) { var attributeArray = i.GetCustomAttributes(attributeType, false); if (0 == attributeArray.Length) { throw new Bam.Core.Exception("Settings interface {0} is missing attribute {1}", i.ToString(), attributeType.ToString()); } var attribute = attributeArray[0] as Bam.Core.SettingsExtensionsAttribute; var cloneSettingsMethod = attribute.GetMethod("Clone", new[] { i, i }); if (null == cloneSettingsMethod) { throw new Bam.Core.Exception("Unable to find extension method {0}.SharedSettings(this {1}, {1}, {1}, {1})", attribute.ExtensionsClassName, i.ToString()); } var intersectSettingsMethod = attribute.GetMethod("Intersect", new[] { i, i }); if (null == intersectSettingsMethod) { throw new Bam.Core.Exception("Unable to find extension method {0}.Intersect(this {1}, {1})", attribute.ExtensionsClassName, i.ToString()); } var objectFileCount = objectFiles.Count(); cloneSettingsMethod.Invoke(null, new[] { commonSettings, objectFiles.First().Settings }); for (int objIndex = 1; objIndex < objectFileCount; ++objIndex) { intersectSettingsMethod.Invoke(null, new[] { commonSettings, objectFiles.ElementAt(objIndex).Settings }); } } return commonSettings; }
private static MethodInfo getMethod( System.Type type, string name, System.Type[] paramTypes ) { // NOTE: There is a bug in Unity 4.3.3+ on Windows Phone that causes all reflection // method overloads that take a BindingFlags parameter to throw a runtime exception. // This means that we cannot have 100% compatibility between Unity 4.3.3 and prior // versions on the Windows Phone platform, and that some functionality // will unfortunately be lost. #if UNITY_EDITOR || !UNITY_WP8 var method = type.GetMethod( name, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, null, paramTypes, null ); return method; #else var methods = type.GetMethods(); for( int i = 0; i < methods.Length; i++ ) { var info = methods[ i ]; if( info.IsStatic || info.Name != name ) continue; if( matchesParameterTypes( info, paramTypes ) ) return info; } return null; #endif }
public Delegate GetMethod(string name, System.Type delegShape) { if (_wrappedObject == null) throw new InvalidOperationException("Can only access static members."); if (!delegShape.IsSubclassOf(typeof(Delegate))) throw new ArgumentException("Type must inherit from Delegate.", "delegShape"); var binding = PUBLIC_MEMBERS; if (_includeNonPublic) binding |= BindingFlags.NonPublic; var invokeMeth = delegShape.GetMethod("Invoke"); var paramTypes = (from p in invokeMeth.GetParameters() select p.ParameterType).ToArray(); MethodInfo meth = null; try { meth = _wrappedType.GetMethod(name, binding, null, paramTypes, null); } catch { try { meth = _wrappedType.GetMethod(name, binding); } catch { } } if (meth != null) { try { return Delegate.CreateDelegate(delegShape, _wrappedObject, meth); } catch (Exception ex) { throw new InvalidOperationException("A method matching the name and shape requested could not be found.", ex); } } else { throw new InvalidOperationException("A method matching the name and shape requested could not be found."); } }
public static object InvokeStringParseMethod(object value, System.Type targetType, IFormatProvider formatInfo) { object parseMethodNotFound; try { MethodInfo info = targetType.GetMethod("Parse", BindingFlags.Public | BindingFlags.Static, null, new System.Type[] { stringType, typeof(NumberStyles), typeof(IFormatProvider) }, null); if (info != null) { return info.Invoke(null, new object[] { (string) value, NumberStyles.Any, formatInfo }); } info = targetType.GetMethod("Parse", BindingFlags.Public | BindingFlags.Static, null, new System.Type[] { stringType, typeof(IFormatProvider) }, null); if (info != null) { return info.Invoke(null, new object[] { (string) value, formatInfo }); } info = targetType.GetMethod("Parse", BindingFlags.Public | BindingFlags.Static, null, new System.Type[] { stringType }, null); if (info != null) { return info.Invoke(null, new object[] { (string) value }); } parseMethodNotFound = Formatter.parseMethodNotFound; } catch (TargetInvocationException exception) { throw new FormatException(exception.InnerException.Message, exception.InnerException); } return parseMethodNotFound; }
static IPropertyGUI getPropertyGUI(System.Type lType) { IPropertyGUI lOut; if (!typeToUiItems.TryGetValue(lType, out lOut)) { var lGetPropertyGUI = lType.GetMethod("get_PropertyGUI"); if (lGetPropertyGUI != null) { lOut = (IPropertyGUI)lGetPropertyGUI.Invoke(null,null); } else { lOut = new CPropertyGUI(getUiItemList(lType)); } typeToUiItems[lType] = lOut; } return lOut; }
public Runtime.ExecuteHandler Complete(System.Type program) { if (_options.DebugOn) SaveAssembly(); return (Runtime.ExecuteHandler)program.GetMethod("Main").CreateDelegate(typeof(Runtime.ExecuteHandler)); }
ExecutePostBuild( System.Type metaType) { var method = metaType.GetMethod("PostExecution"); if (null == method) { return; } try { method.Invoke(null, null); } catch (System.Reflection.TargetInvocationException exception) { var inner = exception.InnerException; while (inner.InnerException != null) { inner = inner.InnerException; } throw new Exception(inner, "Post-build error:"); } }
private static bool IsMethodOverridden(System.Type clazz, System.String name, System.Type[] params_Renamed) { try { System.Reflection.MemberInfo mi = clazz.GetMethod(name, params_Renamed); if (mi == null) throw new SystemException("Can not find method \"" + name + "\""); return mi.DeclaringType != typeof(Similarity); //return clazz.GetMethod(name, (params_Renamed == null) ? new System.Type[0] : (System.Type[])params_Renamed).DeclaringType != typeof(Similarity); } catch (System.MethodAccessException e) { // should not happen throw new System.SystemException(e.Message, e); } catch (Exception ex) { throw new SystemException(ex.Message); } }
private static System.Type GetBindingValueType(string path, System.Type type, GameObject gameObject, bool command, ref string tail) { tail = string.Empty; if (string.IsNullOrEmpty(path)) { Debug.Log("Binding is empty for object " + GetGameObjectPath(gameObject)); return null; } var parts = path.Split('.'); var pathMessage = ""; for (var i = 0; i < parts.Length; ++i) { var part = parts[i]; pathMessage += part; if (i < parts.Length - 1) { int index; if (int.TryParse(part, out index)) { for (var j = i + 1; j < parts.Length; ++j) tail += parts[j] + "."; if (tail.Length > 0) tail = tail.Substring(0, tail.Length - 1); return type; } else { var nodeProperty = type.GetProperty(part); if (nodeProperty == null) { Debug.LogError("Failed to resolve node in binding " + path + " in object " + GetGameObjectPath(gameObject) + "\nerror at " + pathMessage); return null; } pathMessage += "."; type = nodeProperty.PropertyType; } } else { if (command) { var leafCommand = type.GetMethod(part); if (leafCommand == null) { Debug.LogError("Failed to resolve leaf command in binding " + path + " in object " + GetGameObjectPath(gameObject) + "\nerror at " + pathMessage); return null; } } else { var leafProperty = type.GetProperty(part); if (leafProperty == null) { Debug.LogError("Failed to resolve leaf property in binding " + path + " in object " + GetGameObjectPath(gameObject) + "\nerror at " + pathMessage); return null; } type = leafProperty.PropertyType; } } } return type; }
/// <summary> Looks up the method with specified name and signature in the first public /// superclass or implemented interface of the class. /// </summary> /// <param name="class">the class whose method is sought /// </param> /// <param name="name">the name of the method /// </param> /// <param name="paramTypes">the classes of method parameters /// </param> private static System.Reflection.MethodInfo getPublicMethod(System.Type clazz, System.String name, System.Type[] paramTypes) { /* * if this class is public, then try to get it */ if (clazz.IsPublic) { try { return clazz.GetMethod(name, (System.Type[]) paramTypes); } catch (System.MethodAccessException e) { /* * If the class does not have the method, then neither its * superclass nor any of its interfaces has it so quickly return * null. */ return null; } } /* * try the superclass */ System.Type superclazz = clazz.BaseType; if (superclazz != null) { System.Reflection.MethodInfo superclazzMethod = getPublicMethod(superclazz, name, paramTypes); if (superclazzMethod != null) { return superclazzMethod; } } /* * and interfaces */ System.Type[] interfaces = clazz.GetInterfaces(); for (int i = 0; i < interfaces.Length; ++i) { System.Reflection.MethodInfo interfaceMethod = getPublicMethod(interfaces[i], name, paramTypes); if (interfaceMethod != null) { return interfaceMethod; } } return null; }
private static bool IsMethodOverridden(System.Type clazz, System.String name, System.Type[] params_Renamed) { try { return clazz.GetMethod(name, (params_Renamed == null)?new System.Type[0]:(System.Type[]) params_Renamed).DeclaringType != typeof(Similarity); } catch (System.MethodAccessException e) { // should not happen throw new System.SystemException(e.Message, e); } }
internal void tryUpcasting(System.Type clazz) { method = clazz.GetMethod(name, (System.Type[]) parameterTypes); name = null; parameterTypes = null; upcast = true; }