本文整理汇总了C#中System.Reflection.MethodInfo类的典型用法代码示例。如果您正苦于以下问题:C# System.Reflection.MethodInfo类的具体用法?C# System.Reflection.MethodInfo怎么用?C# System.Reflection.MethodInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
System.Reflection.MethodInfo类属于命名空间,在下文中一共展示了System.Reflection.MethodInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: DispatchExceptionFailureEventArgs
public DispatchExceptionFailureEventArgs(Exception ex, IQHsm hsm, System.Reflection.MethodInfo stateMethod, IQEvent ev)
{
_Exception = ex;
_Hsm = hsm;
_StateMethod = stateMethod;
_OriginalEvent = ev;
}
开发者ID:poobalan-arumugam,项目名称:stateproto,代码行数:7,代码来源:DispatchExceptionFailureEventArgs.cs
示例2: ProcessParams
public override bool ProcessParams(MethodInfo method, int paramNum, IFacetHolder holder) {
ParameterInfo parameter = method.GetParameters()[paramNum];
Attribute attribute = parameter.GetCustomAttributeByReflection<DescriptionAttribute>();
if (attribute == null) {
attribute = parameter.GetCustomAttributeByReflection<DescribedAsAttribute>();
}
return FacetUtils.AddFacet(Create(attribute, holder));
}
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:8,代码来源:DescribedAsAnnotationFacetFactory.cs
示例3: Process
public override bool Process(MethodInfo method, IMethodRemover methodRemover, IFacetHolder holder) {
var classAttribute = method.DeclaringType.GetCustomAttributeByReflection<AuthorizeActionAttribute>();
var methodAttribute = method.GetCustomAttribute<AuthorizeActionAttribute>();
if (classAttribute != null && methodAttribute != null) {
Log.WarnFormat("Class and method level AuthorizeAttributes applied to class {0} - ignoring attribute on method {1}", method.DeclaringType.FullName, method.Name);
}
return Create(classAttribute ?? methodAttribute, holder);
}
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:10,代码来源:AuthorizeAnnotationFacetFactory.cs
示例4: BuildAccessor
private static System.Func<object, object> BuildAccessor(MethodInfo method)
{
ParameterExpression obj = Expression.Parameter(typeof(object), "obj");
UnaryExpression instance = !method.IsStatic ? Expression.Convert(obj, method.DeclaringType) : null;
Expression<System.Func<object, object>> expr = Expression.Lambda<System.Func<object, object>>(
Expression.Convert(
Expression.Call(instance, method),
typeof(object)),
obj);
return expr.Compile();
}
开发者ID:antlr,项目名称:antlrcs,代码行数:12,代码来源:ObjectModelAdaptor.cs
示例5: MdaMethodImpl
// ------------------------------------------------------------------------
// private final MdaClass parentMdaClass; .. see super
// private final String methodName; .. see super.getName
// constructors
// -------------------------------------------------------------------------
public MdaMethodImpl(MdaClass parentMdaClass, int internalMethodIndex,
System.Reflection.MethodInfo method, PropertiesNode tags)
: base(method.Name, tags, parentMdaClass)
{
this.internalMethodIndex = internalMethodIndex;
this.method = method;
this.returnType = method.ReturnType;
if (returnType == null)
{
throw new System.InvalidOperationException("returnType == null for Method " + this);
}
}
开发者ID:Arnaud-Nauwynck,项目名称:test-dotnet-snippets,代码行数:17,代码来源:MdaMethodImpl.cs
示例6: Message
public Message(MessageID msgid, string msgname, Int16 length, List<Byte> msgargtypes, System.Reflection.MethodInfo msghandler)
{
id = msgid;
name = msgname;
msglen = length;
handler = msghandler;
argtypes = new System.Reflection.MethodInfo[msgargtypes.Count];
for(int i=0; i<msgargtypes.Count; i++)
{
argtypes[i] = StreamRWBinder.bindReader(msgargtypes[i]);
if(argtypes[i] == null)
{
Dbg.ERROR_MSG("Message::Message(): bindReader(" + msgargtypes[i] + ") is error!");
}
}
// Dbg.DEBUG_MSG(string.Format("Message::Message(): ({0}/{1}/{2})!",
// msgname, msgid, msglen));
}
开发者ID:hellopcworld,项目名称:kbengine,代码行数:20,代码来源:Message.cs
示例7: Process
public override bool Process(MethodInfo actionMethod, IMethodRemover methodRemover, IFacetHolder action) {
string capitalizedName = NameUtils.CapitalizeName(actionMethod.Name);
Type type = actionMethod.DeclaringType;
var facets = new List<IFacet>();
INakedObjectSpecification onType = Reflector.LoadSpecification(type);
INakedObjectSpecification returnSpec = Reflector.LoadSpecification(actionMethod.ReturnType);
RemoveMethod(methodRemover, actionMethod);
facets.Add(new ActionInvocationFacetViaMethod(actionMethod, onType, returnSpec, action));
MethodType methodType = actionMethod.IsStatic ? MethodType.Class : MethodType.Object;
Type[] paramTypes = actionMethod.GetParameters().Select(p => p.ParameterType).ToArray();
FindAndRemoveValidMethod(facets, methodRemover, type, methodType, capitalizedName, paramTypes, action);
DefaultNamedFacet(facets, capitalizedName, action); // must be called after the checkForXxxPrefix methods
AddHideForSessionFacetNone(facets, action);
AddDisableForSessionFacetNone(facets, action);
FindDefaultHideMethod(facets, methodRemover, type, methodType, "ActionDefault", paramTypes, action);
FindAndRemoveHideMethod(facets, methodRemover, type, methodType, capitalizedName, paramTypes, action);
FindDefaultDisableMethod(facets, methodRemover, type, methodType, "ActionDefault", paramTypes, action);
FindAndRemoveDisableMethod(facets, methodRemover, type, methodType, capitalizedName, paramTypes, action);
if (action is DotNetNakedObjectActionPeer) {
var nakedObjectActionPeer = (DotNetNakedObjectActionPeer) action;
// Process the action's parameters names, descriptions and optional
// an alternative design would be to have another facet factory processing just ActionParameter, and have it remove these
// supporting methods. However, the FacetFactory API doesn't allow for methods of the class to be removed while processing
// action parameters, only while processing Methods (ie actions)
INakedObjectActionParamPeer[] actionParameters = nakedObjectActionPeer.Parameters;
string[] paramNames = actionMethod.GetParameters().Select(p => p.Name).ToArray();
FindAndRemoveParametersAutoCompleteMethod(methodRemover, type, capitalizedName, paramTypes, actionParameters);
FindAndRemoveParametersChoicesMethod(methodRemover, type, capitalizedName, paramTypes, paramNames, actionParameters);
FindAndRemoveParametersDefaultsMethod(methodRemover, type, capitalizedName, paramTypes, paramNames, actionParameters);
FindAndRemoveParametersValidateMethod(methodRemover, type, capitalizedName, paramTypes, paramNames, actionParameters);
}
return FacetUtils.AddFacets(facets);
}
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:40,代码来源:ActionMethodsFacetFactory.cs
示例8: Message
public Message(MessageID msgid, string msgname, Int16 length, sbyte argstype, List<Byte> msgargtypes, System.Reflection.MethodInfo msghandler)
{
id = msgid;
name = msgname;
msglen = length;
handler = msghandler;
argsType = argstype;
// 对该消息的所有参数绑定反序列化方法,改方法能够将二进制流转化为参数需要的值
// 在服务端下发消息数据时会用到
argtypes = new KBEDATATYPE_BASE[msgargtypes.Count];
for(int i=0; i<msgargtypes.Count; i++)
{
if(!EntityDef.id2datatypes.TryGetValue(msgargtypes[i], out argtypes[i]))
{
Dbg.ERROR_MSG("Message::Message(): argtype(" + msgargtypes[i] + ") is not found!");
}
}
// Dbg.DEBUG_MSG(string.Format("Message::Message(): ({0}/{1}/{2})!",
// msgname, msgid, msglen));
}
开发者ID:jiangzhuo,项目名称:kbengine_dotnet,代码行数:22,代码来源:Message.cs
示例9: DisplayMethodProperties
public void DisplayMethodProperties(System.Reflection.MethodInfo Method)
{
ThisMethod = Method;
// Show the method name
Label2.Text = ThisMethod.Name;
// Show the calling convention
Label4.Text = "0x" + ThisMethod.CallingConvention.ToString("x") +
" = " + ThisMethod.CallingConvention.ToString();
// Show the method's standard attributes
Label6.Text = "0x" + ThisMethod.Attributes.ToString("x") +
" = " + ThisMethod.Attributes.ToString();
// Show the return type
Label8.Text = ThisMethod.ReturnType.FullName;
// Show the parameters
foreach (System.Reflection.ParameterInfo parm in ThisMethod.GetParameters())
{
//ListBox1.Items.Add(parm.Name + " as " + parm.ParameterType.FullName);
ListBox1.Items.Add(parm.ParameterType);//changed because I need the type later
}
// Show the custom attributes
foreach (object attr in ThisMethod.GetCustomAttributes(true))
{
ListBox2.Items.Add(attr);
}
}
开发者ID:dust2098,项目名称:e33-dispatcher-application,代码行数:37,代码来源:frmDisplayMethod.cs
示例10: FindResourceNameEncodingMethod
private void FindResourceNameEncodingMethod()
{
System.Reflection.Assembly a = AssemblyUtils.LoadAssemblyFile(_assembly.MainModule.FullyQualifiedName);
Type[] types = a.GetTypes();
if (types != null)
{
for (int i = 0; i < types.Length; i++)
{
Type type = types[i];
if (IsBaseType("System.Resources.ResourceManager", type))
{
System.Reflection.MethodInfo[] methods = type.GetMethods(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
if (methods != null)
{
for (int j = 0; j < methods.Length; j++)
{
System.Reflection.MethodInfo method = methods[j];
if (method.ReturnType.FullName == "System.String")
{
System.Reflection.ParameterInfo[] parameters = method.GetParameters();
if (parameters != null && parameters.Length == 1 && parameters[0].ParameterType.FullName == "System.String")
{
_encodingMethod = method;
break;
}
}
}
}
if (_encodingMethod != null)
break;
}
}
}
}
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:35,代码来源:DeobfPlugin.cs
示例11: CreateSerializationErrorCallback
internal static SerializationErrorCallback CreateSerializationErrorCallback(MethodInfo callbackMethodInfo)
{
return (o, context, econtext) => callbackMethodInfo.Invoke(o, new object[] { context, econtext });
}
开发者ID:cilliemalan,项目名称:Cargo,代码行数:4,代码来源:JsonContract.cs
示例12: Bridge
public Bridge()
{
this.lDomain = System.AppDomain.CurrentDomain;
this.LoadTypes();
this.lTimeout = 30000;
lHandleEventMethod = this.GetType().GetMethod("HandleEvent");
this.timerhotkey = new System.Timers.Timer(100);
this.timerhotkey.Elapsed += new System.Timers.ElapsedEventHandler(TimerCheckHotKey);
AppDomain.CurrentDomain.UnhandledException += AppDomain_UnhandledException;
System.Windows.Forms.Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
}
开发者ID:a711960,项目名称:net-com-bridge,代码行数:11,代码来源:Bridge.cs
示例13: Init
public override void Init(Reactor reactor)
{
base.Init(reactor);
var cm = reactor.FindMethod (functionName);
if (cm == null) {
Debug.LogError ("Could not load function method: " + functionName);
} else {
component = cm.component;
methodInfo = cm.methodInfo;
}
}
开发者ID:s76,项目名称:testAI,代码行数:11,代码来源:Function.cs
示例14: ObjectBusMessageDeserializerAttribute
public ObjectBusMessageDeserializerAttribute(Type type, string funcName)
{
if (funcName == null)
throw new ArgumentNullException ("funcName");
func = type.GetMethod (funcName, System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
if (func == null) {
Console.Write ("ObjectBusMessageDeserializerAttribute is going into failsafe mode, ");
func = type.GetMethod (funcName, System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic);
if (func == null)
Console.WriteLine ("failed.");
else
Console.WriteLine ("succeeded.");
}
}
开发者ID:vebin,项目名称:BD2,代码行数:14,代码来源:ObjectBusMessageDeserializerAttribute.cs
示例15: SnowballFilter
/// <summary>Construct the named stemming filter.
///
/// </summary>
/// <param name="in">the input tokens to stem
/// </param>
/// <param name="name">the name of a stemmer
/// </param>
public SnowballFilter(TokenStream in_Renamed, System.String name) : base(in_Renamed)
{
try
{
System.Type stemClass = System.Type.GetType("SF.Snowball.Ext." + name + "Stemmer");
stemmer = (SnowballProgram) System.Activator.CreateInstance(stemClass);
// why doesn't the SnowballProgram class have an (abstract?) stem method?
stemMethod = stemClass.GetMethod("Stem", (new System.Type[0] == null) ? new System.Type[0] : (System.Type[]) new System.Type[0]);
}
catch (System.Exception e)
{
throw new System.SystemException(e.ToString());
}
}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:21,代码来源:SnowballFilter.cs
示例16: Init
public override void Init(Reactor reactor)
{
base.Init(reactor);
var cm = reactor.FindMethod(conditionMethod);
if(cm == null) {
Debug.LogError("Could not load condition method: " + conditionMethod);
} else {
if(cm.methodInfo.ReturnType == typeof(bool)) {
component = cm.component;
methodInfo = cm.methodInfo;
} else {
Debug.LogError("Condition method has invalid signature: " + conditionMethod);
}
}
}
开发者ID:s76,项目名称:testAI,代码行数:15,代码来源:If.cs
示例17: ExecCmd
static ExecCmd()
{
{
// Runtime.exec(String[] cmdArr, String[] envArr, File currDir)
Type[] parameterTypes = new Type[] { typeof( string[] ), typeof( string[] ), typeof( FileInfo ) };
try
{
execMethod = System.Diagnostics.Process.GetCurrentProcess().GetType().GetMethod( "exec", (System.Type[])parameterTypes );
}
catch ( System.MethodAccessException e )
{
execMethod = null;
}
}
}
开发者ID:R4P3NET,项目名称:TS3SRV-ASE,代码行数:15,代码来源:ExecCmd.cs
示例18: RawProxyAttribute
public RawProxyAttribute(Type type, string guid, string deserializeMethodName)
{
if (guid == null)
throw new ArgumentNullException ("guid");
if (deserializeMethodName == null)
throw new ArgumentNullException ("deserializeMethodName");
this.deserializeMethodName = deserializeMethodName;
this.guid = Guid.Parse (guid);
deserializeMethod = type.GetMethod (deserializeMethodName, System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
attribs.AddOrUpdate (this.guid, (g) => {
return this;
}, (g,o) => {
return this;
}
);
}
开发者ID:vebin,项目名称:BD2,代码行数:16,代码来源:RawProxyAttribute.cs
示例19: GtkWorkarounds
static GtkWorkarounds ()
{
if (Platform.IsMac) {
InitMac ();
}
var flags = System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic;
glibObjectSetProp = typeof (GLib.Object).GetMethod ("SetProperty", flags);
glibObjectGetProp = typeof (GLib.Object).GetMethod ("GetProperty", flags);
foreach (int i in new [] { 24, 22, 20, 18, 16, 14 }) {
if (Gtk.Global.CheckVersion (2, (uint)i, 0) == null) {
GtkMinorVersion = i;
break;
}
}
}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:17,代码来源:GtkWorkarounds.cs
示例20: MySocket
public MySocket()
{
//System.Net.Sockets.TcpClient client = new System.Net.Sockets.TcpClient();
//UnityEngine.Debug.Log(client.GetType().Assembly.GetName().Name);
//tcpClient = client;//System.Activator.CreateInstance(GetType().Assembly.FullName, "System.Net.Sockets.TcpClient");
System.Type testType = typeof(System.Uri);
System.Type clazz = testType.Assembly.GetType("System.Net.Sockets.TcpClient");
tcpClient = clazz.GetConstructor(new System.Type[]{}).Invoke(null);
//tcpClient = System.Activator.CreateInstance(testType.Assembly.FullName, "System.Net.Sockets.TcpClient");
availableProperty = clazz.GetProperty("Available");
connectedProperty = clazz.GetProperty("Connected");
connectMethod = clazz.GetMethod("Connect", new System.Type[] {typeof(string), typeof(int)});
getStreamMethod = clazz.GetMethod("GetStream");
closeMethod = clazz.GetMethod("Close");
}
开发者ID:feamorx86,项目名称:UnityChatTest,代码行数:20,代码来源:MySockets.cs
注:本文中的System.Reflection.MethodInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论