Ví dụ 3!
Creating Custom Attributes(tạo một Attributes)
* Lớp tạo Attributes
PHP Code:
/*
* Created by SharpDevelop.
* NetDevelop Co., Ltd.
* Author: Tuan Anh Nguyen Ngoc
* Date: 11/24/2006
* Contact Information.
* - Email: [email protected]
* - Handheld: +84 905 202 088
*/
using System;
namespace AdvancedDotnet
{
/// <summary>
/// Định nghĩa Author Attribute.
/// </summary>
[AttributeUsage(AttributeTargets.Method|AttributeTargets.Property|AttributeTargets.S
truct,AllowMultiple=false,Inherited=false)]
public class AuthorAttribute : Attribute
{
private string _sName;
public AuthorAttribute(string name)
{
this._sName = name;
class MainClass
{
[Author("tuan anh nguyen ngoc")]
public static void Main()
{
///do samething
}
}
} Quote:
[Author("tuan anh nguyen ngoc")]
Author chính là Attributes ta tạo ra
chúc các bạn thành công! có vấn đề gì cần hỏi có thể liên hệ với mình ở thông tin trên,
dauden(UDS)