lundi 27 avril 2015

C# method tagging

I'm creating a database application in C# and so I wrote a Query class. I want to mark a method inside the class as a step of the query's initialization so I could dynamically build different types of queries using only one class. I noticed there is an AttributeUsage tag but I'm not familiar it. My question is how can I create my own tag, or how can I use an existing attribute for my own need? This is my direction:

[InitializationStep]
SetArguments(object[] args)
{
    // some code
}
[InitializationStep]
SetDatabaseName(object[] args)
{
    // some code
}
...

I also need a way to tell my classes that one method is an overloaded version of another. Thanks very much.





Aucun commentaire:

Enregistrer un commentaire