本文整理汇总了C#中System.Reflection.Module.GetCustomAttributes方法的典型用法代码示例。如果您正苦于以下问题:C# Module.GetCustomAttributes方法的具体用法?C# Module.GetCustomAttributes怎么用?C# Module.GetCustomAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.Module
的用法示例。
在下文中一共展示了Module.GetCustomAttributes方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCustomAttributes
public static Attribute[] GetCustomAttributes (Module element, Type attributeType, bool inherit)
{
// element parameter is not allowed to be null
CheckParameters (element, attributeType);
return (Attribute []) element.GetCustomAttributes (attributeType, inherit);
}
示例2: WriteCustomAttributes
private void WriteCustomAttributes(XmlWriter writer, Module module)
{
WriteCustomAttributes(writer, module.GetCustomAttributes(this.rep.DocumentInheritedAttributes), "module");
}
示例3: GetCustomAttributes
public static Attribute[] GetCustomAttributes(Module element, Type attributeType, bool inherit)
{
if (element == null)
throw new ArgumentNullException(nameof(element));
if (attributeType == null)
throw new ArgumentNullException(nameof(attributeType));
if (!attributeType.IsSubclassOf(typeof(Attribute)) && attributeType != typeof(Attribute))
throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));
Contract.EndContractBlock();
return (Attribute[])element.GetCustomAttributes(attributeType, inherit);
}
示例4: GetCustomAttribute
public static Attribute GetCustomAttribute (Module element, Type attributeType, bool inherit)
{
// neither parameter is allowed to be null
CheckParameters (element, attributeType);
// Module inheritance hierarchies CAN NOT be searched for attributes, so the second
// parameter of GetCustomAttributes () is IGNORED.
object[] attributes = element.GetCustomAttributes (attributeType, inherit);
return FindAttribute (attributes);
}
示例5: GetElements
public static ILookup<string, string> GetElements(Module module)
{
return module.GetCustomAttributes(typeof(ElementalAttribute))
.Cast<ElementalAttribute>()
.MakeLookup();
}
示例6: GetCustomAttributes
public static Attribute[] GetCustomAttributes(Module element, Type attributeType, bool inherit)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
if (attributeType == null)
{
throw new ArgumentNullException("attributeType");
}
if (!attributeType.IsSubclassOf(typeof(Attribute)) && (attributeType != typeof(Attribute)))
{
throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));
}
return (Attribute[]) element.GetCustomAttributes(attributeType, inherit);
}
示例7: GetCustomAttributes
internal static Object[] GetCustomAttributes(Module target, Type caType, bool inherit) {
if (!target.Assembly.ReflectionOnly)
return target.GetCustomAttributes(caType, inherit);
return CustomAttribute.ExtractCustomAttribute(CustomAttributeData.GetCustomAttributes(target), caType);
}
示例8: GetCustomAttributesImpl
public override object[] GetCustomAttributesImpl(Module mod, Type attributeType, bool inherit)
{
System.Diagnostics.Debug.WriteLine("In GetCustomAttributesImpl 1");
#if !DEBUG || true
var name = mod.Name;
if (mod.Name.Contains("IKVM.OpenJDK") || name.Contains("CodenameOne") || name.Contains("HelloWindows"))
{
return new JavaModuleAttribute[] { new JavaModuleAttribute() };
}
#endif
var s = mod.GetCustomAttributes(attributeType).ToArray();
return s;
}
示例9: GetCustomAttributes
public static Attribute[] GetCustomAttributes (Module element, bool inherit)
{
// element parameter is not allowed to be null
CheckParameters (element, typeof (Attribute));
return (Attribute []) element.GetCustomAttributes (inherit);
}