GetMethod() public method

Gets the method defined by name and params for the Class c.
public GetMethod ( Type c, String name, Object parameters ) : MethodInfo
c System.Type Class in which the method search is taking place
name String Name of the method being searched for
parameters Object An array of Objects (not Classes) that describe the the parameters
return System.Reflection.MethodInfo
        public void Test_Evaluate()
        {
            IRuntimeServices rs = RuntimeSingleton.RuntimeServices;
            Introspector i = new Introspector(rs);
            MethodInfo mi = i.GetMethod(typeof(VelocityTest), "Test_Evaluate", null);
            Assert.IsNotNull(mi, "Expected to find VelocityTest.Test_Evaluate");
            Assert.IsTrue(mi.ToString().Equals("Void Test_Evaluate()"), "method not found");

            mi = i.GetMethod(typeof(ExtendedProperties), "GetString", new Object[] {"parm1", "parm2"});
            Assert.IsNotNull(mi, "Expected to find ExtendedProperties.GetString(String, String)");
            Assert.IsTrue(mi.ToString().Equals("System.String GetString(System.String, System.String)"), "method not found");
        }
Esempio n. 2
0
		/// <summary>
		/// Default constructor.
		/// </summary>
		public GetExecutor(IRuntimeLogger r, Introspector i, Type c, String key)
		{
			runtimeLogger = r;
			arguments[0] = key;

			// NOTE: changed from get to get to get_Item - assumption is that get would be converted to an indexer in .Net
			// to keep some resemblance to the Java version, look for "Get" and "get" methods as well (both cases for .Net style and java)
			method = i.GetMethod(c, "get_Item", arguments);
			if (method == null)
			{
				method = i.GetMethod(c, "Get", arguments);
				if (method == null)
				{
					method = i.GetMethod(c, "get", arguments);
				}
			}
		}