.cs文件里的[]表示什么?看别人的aspx.cs里的文件时 偶尔都会见到[xxxxx] 的写法
这表示什么呢?可以肯定不是数组大概是这样的
[ToolboxData]
{
public class Lists:System.UI.WebControls.WebControl
}
这表示什么呢?可以肯定不是数组大概是这样的
[ToolboxData]
{
public class Lists:System.UI.WebControls.WebControl
}
解决方案 »
- 地图
- 输入字符串的格式不正确 问题
- 今天发现一个问题,难得这么高兴,散分100,哈哈
- ■■问一条SQL写法distinct(id)之后怎么计算他的总记录数Coung(*)呢?
- 文件的虚拟路径(Server.MapPath的使用)
- 这行代码看不懂,帮忙看一下谢谢啦
- 提交老是出现问题!
- 还是关于全屏显示的问题?
- 关于下载功能的提问,请高手指点!
- 表单创建sql语句的时候怎么彻底消除输入'的副作用?
- ### 求一目录树 ###
- 这条SQL语句什么意思?SHAPE {select a,sum(b) as sumb,sum(c) as sumc,sum(b)/sum(c) as sumbc from table1 group by a} AS xxx APPEND
using System.Reflection;namespace CustomAttrCS {
// An enumeration of animals. Start at 1 (0 = uninitialized).
public enum Animal {
// Pets.
Dog = 1,
Cat,
Bird,
} // A custom attribute to allow a target to have a pet.
public class AnimalTypeAttribute : Attribute {
// The constructor is called when the attribute is set.
public AnimalTypeAttribute(Animal pet) {
thePet = pet;
} // Keep a variable internally ...
protected Animal thePet; // .. and show a copy to the outside world.
public Animal Pet {
get { return thePet; }
set { thePet = Pet; }
}
} // A test class where each method has its own pet.
class AnimalTypeTestClass {
[AnimalType(Animal.Dog)]
public void DogMethod() {} [AnimalType(Animal.Cat)]
public void CatMethod() {} [AnimalType(Animal.Bird)]
public void BirdMethod() {}
} class DemoClass {
static void Main(string[] args) {
AnimalTypeTestClass testClass = new AnimalTypeTestClass();
Type type = testClass.GetType();
// Iterate through all the methods of the class.
foreach(MethodInfo mInfo in type.GetMethods()) {
// Iterate through all the Attributes for each method.
foreach (Attribute attr in
Attribute.GetCustomAttributes(mInfo)) {
// Check for the AnimalType attribute.
if (attr.GetType() == typeof(AnimalTypeAttribute))
Console.WriteLine(
"Method {0} has a pet {1} attribute.",
mInfo.Name, ((AnimalTypeAttribute)attr).Pet);
} }
}
}
}