婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > Attribute/特性心得隨筆

Attribute/特性心得隨筆

熱門標簽:外呼系統代理品牌 怎么給超市做地圖標注入駐店 外呼系統費用一年 辦理400電話證件 巫師3為什么地圖標注的財寶沒有 十堰正規電銷機器人系統 手機地圖標注如何刪除 世紀佳緣地圖標注怎么去掉 寧波自動外呼系統代理
復制代碼 代碼如下:

p>/*/p>p>*特性/p>p>*//p>

復制代碼 代碼如下:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// summary>
/// DisAttribute 的摘要說明
/// /summary>
public class DisAttribute : Attribute
{
private string _message;
/// summary>
/// 描述
/// /summary>
public string Message
{
get { return _message; }
}

public DisAttribute(string message)
{
this._message = message;
}
}

/*

*類

*/
復制代碼 代碼如下:

using System;
using System.Collections.Generic;
using System.EnterpriseServices;
using System.Linq;
using System.Web;
using System.Web.DynamicData;


/// summary>
/// User 的摘要說明
/// /summary>
[DisAttribute("User"),TableName("user"),Description("user")]
public class User
{
private int? _id;
/// summary>
/// Id
/// /summary>
[DisAttribute("主鍵")]
public int? Id
{
get { return _id; }
set { _id = value; }
}


private string _name;
/// summary>
/// 名稱
/// /summary>
[DisAttribute("名稱")]
public string Name
{
get { return _name; }
set { _name = value; }
}
}

/*

*獲取

*/
復制代碼 代碼如下:

//獲取特性
User u = new User();
Type _t = u.GetType();
foreach (Attribute a in _t.GetCustomAttributes(true))
{
if (a.GetType().ToString() == "DisAttribute")
{
DisAttribute _da = (DisAttribute)a;
if (_da != null)
{
Response.Write(_da.Message + "br>");
}
}
}
//獲取所有屬性
u.Id = 888888;
u.Name = "陳奕迅";
foreach (PropertyInfo item in _t.GetProperties())
{
//特性
Attribute atr = item.GetCustomAttribute(typeof(DisAttribute));
if (atr.GetType().ToString() == "DisAttribute")
{
DisAttribute _da = (DisAttribute)atr;
if (_da != null)
{
Response.Write(_da.Message + "br>");
}
}
}

標簽:泰州 山西 通遼 平涼 天門 景德鎮 牡丹江 嘉興

巨人網絡通訊聲明:本文標題《Attribute/特性心得隨筆》,本文關鍵詞  Attribute,特性,心得,隨筆,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《Attribute/特性心得隨筆》相關的同類信息!
  • 本頁收集關于Attribute/特性心得隨筆的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 古田县| 辽源市| 宜宾市| 丽江市| 灵寿县| 筠连县| 连州市| 东港市| 绥阳县| 蒙城县| 仲巴县| 屯留县| 苏尼特右旗| 江北区| 池州市| 商城县| 武安市| 天峨县| 内丘县| 万载县| 齐齐哈尔市| 彭州市| 西畴县| 荆州市| 庆城县| 固安县| 丰原市| 永年县| 炉霍县| 珠海市| 衡东县| 文安县| 中牟县| 股票| 奉化市| 潮安县| 隆子县| 沧州市| 南平市| 岱山县| 玛沁县|