ふらっとC#,C♯,C#( ..
[2ch|▼Menu]
97:デフォルトの名無しさん
08/03/01 23:20:22
>>94
ちょっと作ってみた
public class MyAttribute : System.Attribute
{
public int IntData { get;set;}
public MyAttribute(int intData) { IntData = intData ; }
};
public class SumpleClass
{
[My(10)]
public int Field = 5 ;
};
void f(){
var tmp = new SumpleClass() ;
var attrs = tmp.GetType().GetField( "Field" ).GetCustomAttributes( false ) ;
for (int i = 0; i < attrs.GetLength(0); ++i)
{
var myattr = attrs[i] as MyAttribute ;
if (myattr == null) continue;
System.Console.WriteLine("{0}", myattr.IntData);
}
}


次ページ
最新レス表示
スレッドの検索
類似スレ一覧
話題のニュース
おまかせリスト
▼オプションを表示
暇つぶし2ch

4437日前に更新/241 KB
担当:undef