This could be very basic..
I have a class
[Version("2"), Caching(false)]
class Sample
{
.....
}
How can i access the values of the attributes Version and Caching in C#?
This could be very basic..
I have a class
[Version("2"), Caching(false)]
class Sample
{
.....
}
How can i access the values of the attributes Version and Caching in C#?
Actually isn't that basic. The way to do this is through reflection.
Here is a microsoft tutorial at how to do it.
Reflection an interesting new technology that allows you to see a class as if from the side -> getting access to private and protected fields and functions, as well as attributes.
これを行うには、fasterflectAPIを使用できます。それはあなたの記述のようなリフレクションタスクを簡単にする拡張メソッドを提供します。