📄 reflectionevent.cs
字号:
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version>$Revision: 915 $</version>
// </file>
using System;
using System.Collections;
using System.Reflection;
using System.Xml;
namespace ICSharpCode.SharpDevelop.Dom
{
[Serializable]
public class ReflectionEvent : DefaultEvent
{
public ReflectionEvent(EventInfo eventInfo, IClass declaringType) : base(declaringType, eventInfo.Name)
{
this.ReturnType = ReflectionReturnType.Create(this, eventInfo.EventHandlerType, false);
// get modifiers
MethodInfo methodBase = null;
try {
methodBase = eventInfo.GetAddMethod(true);
} catch (Exception) {}
if (methodBase == null) {
try {
methodBase = eventInfo.GetRemoveMethod(true);
} catch (Exception) {}
}
ModifierEnum modifiers = ModifierEnum.None;
if (methodBase != null) {
if (methodBase.IsStatic) {
modifiers |= ModifierEnum.Static;
}
if (methodBase.IsAssembly) {
modifiers |= ModifierEnum.Internal;
}
if (methodBase.IsPrivate) { // I assume that private is used most and public last (at least should be)
modifiers |= ModifierEnum.Private;
} else if (methodBase.IsFamily || methodBase.IsFamilyOrAssembly) {
modifiers |= ModifierEnum.Protected;
} else if (methodBase.IsPublic) {
modifiers |= ModifierEnum.Public;
} else {
modifiers |= ModifierEnum.Internal;
}
} else {
// assume public property, if no methodBase could be get.
modifiers = ModifierEnum.Public;
}
this.Modifiers = modifiers;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -