单次特性和多次特性
using System;
using System.Reflection;
[AttributeUsage(AttributeTargets.All,AllowMultiple=true)] //不指定AllowMultiple=true编译汇报错,C#特性默认是单次
public class SingleUseAttribute:Attribute
{
public SingleUseAttribute(string str)
{
}
}
[SingleUse("aaa")]
[SingleUse("bbb")]
public class ServerClass
{
}
public class ClientClass
{
public static void Main()
{
}
}
本文地址:http://com.8s8s.com/it/it42717.htm