本文整理汇总了C#中Method.getParameterTypes方法的典型用法代码示例。如果您正苦于以下问题:C# Method.getParameterTypes方法的具体用法?C# Method.getParameterTypes怎么用?C# Method.getParameterTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Method
的用法示例。
在下文中一共展示了Method.getParameterTypes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetWrite
/// <summary>
/// This is used to acquire a <c>MethodName</c> for the name
/// and annotation of the provided method. This must be a setter
/// method, and so must accept a single argument, if it contains
/// more or less than one argument an exception is thrown.
/// return type that is not void and
/// </summary>
/// <param name="method">
/// this is the method to acquire the name for
/// </param>
/// <param name="type">
/// this is the method type to acquire the name for
/// </param>
/// <returns>
/// this is the method name object for the method
/// </returns>
public MethodName GetWrite(Method method, MethodType type) {
Class[] list = method.getParameterTypes();
String real = method.GetName();
if(list.length != 1) {
throw new MethodException("Set method %s os not a valid property", method);
}
String name = GetTypeName(real, type);
if(name == null) {
throw new MethodException("Could not get name for %s", method);
}
return new MethodName(method, type, name);
}
示例2: GetReturnType
/// <summary>
/// This is the return type associated with the provided method.
/// The return type of the method is provided only if the method
/// adheres to the Java Bean conventions regarding getter methods.
/// If the method takes a parameter then this will return null.
/// </summary>
/// <param name="method">
/// this is the method to get the return type for
/// </param>
/// <returns>
/// this returns the return type associated with it
/// </returns>
public Class GetReturnType(Method method) {
Class[] list = method.getParameterTypes();
if(list.length == 0) {
return method.GetReturnType();
}
return null;
}