|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
compile-time error generating custom attributeshi all,
can I create my own compile-time attributes? e.g. an attribute applied to a method and that will generate a compile time error if the method has the wrong signature? I was hinted twords 'Intellisense API' but cant seem to find it at all... thanx, Picho New/Custom attributes that you created would not be understood by Visual
Studio / Compiler.. Specific to your case, where do you wish to apply this attribute -- checking the method signature? -- Show quoteHappy Hacking, Gaurav Vaish | http://www.mastergaurav.org http://www.edujini.in | http://webservices.edujini.in ------------------- "Picho" <pi***@telhai.ac.il> wrote in message news:uhrTe49lGHA.508@TK2MSFTNGP03.phx.gbl... > hi all, > > can I create my own compile-time attributes? > e.g. an attribute applied to a method and that will generate a compile > time error if the method has the wrong signature? > > I was hinted twords 'Intellisense API' but cant seem to find it at all... > > > thanx, > Picho > thanx for the reply.
I would like to avoid run-time errors caused by objects that apply my attributes to their class members. I could have used simply interfaces but I need more info on the members such as descriptions, and other things. plus I wish to avoid the need of implementing my interface AND applying attributes. when I apply an attribute that is defined to target a method to a property, i get a compilation error right? cant I extend this and create attributes that will validate certains constrains and produce compile-time errors? Show quote "Gaurav Vaish (www.EduJini.IN)" <gaurav.vaish.nospam@nospam.gmail.com> wrote in message news:eucJG%23LmGHA.4052@TK2MSFTNGP05.phx.gbl... > New/Custom attributes that you created would not be understood by Visual > Studio / Compiler.. > > Specific to your case, where do you wish to apply this attribute -- > checking the method signature? > > -- > Happy Hacking, > Gaurav Vaish | http://www.mastergaurav.org > http://www.edujini.in | http://webservices.edujini.in > ------------------- > > > "Picho" <pi***@telhai.ac.il> wrote in message > news:uhrTe49lGHA.508@TK2MSFTNGP03.phx.gbl... >> hi all, >> >> can I create my own compile-time attributes? >> e.g. an attribute applied to a method and that will generate a compile >> time error if the method has the wrong signature? >> >> I was hinted twords 'Intellisense API' but cant seem to find it at all... >> >> >> thanx, >> Picho >> > > "Picho" <pi***@telhai.ac.il> wrote in message You probably do want both... method calls through interfaces are many times news:%23WdnD7OmGHA.508@TK2MSFTNGP03.phx.gbl... > thanx for the reply. > > I would like to avoid run-time errors caused by objects that apply my > attributes to their class members. > > I could have used simply interfaces but I need more info on the members > such as descriptions, and other things. > > plus I wish to avoid the need of implementing my interface AND applying > attributes. faster than reflection on attributes and a reflected call. Show quote > > when I apply an attribute that is defined to target a method to a > property, i get a compilation error right? > > cant I extend this and create attributes that will validate certains > constrains and produce compile-time errors? > > > > "Gaurav Vaish (www.EduJini.IN)" <gaurav.vaish.nospam@nospam.gmail.com> > wrote in message news:eucJG%23LmGHA.4052@TK2MSFTNGP05.phx.gbl... >> New/Custom attributes that you created would not be understood by Visual >> Studio / Compiler.. >> >> Specific to your case, where do you wish to apply this attribute -- >> checking the method signature? >> >> -- >> Happy Hacking, >> Gaurav Vaish | http://www.mastergaurav.org >> http://www.edujini.in | http://webservices.edujini.in >> ------------------- >> >> >> "Picho" <pi***@telhai.ac.il> wrote in message >> news:uhrTe49lGHA.508@TK2MSFTNGP03.phx.gbl... >>> hi all, >>> >>> can I create my own compile-time attributes? >>> e.g. an attribute applied to a method and that will generate a compile >>> time error if the method has the wrong signature? >>> >>> I was hinted twords 'Intellisense API' but cant seem to find it at >>> all... >>> >>> >>> thanx, >>> Picho >>> >> >> > > > I could have used simply interfaces but I need more info on the members Define interfaces.> such as descriptions, and other things. Define attributes.... do both. The implementation class can be discovered dynamically using reflection (say from config files). Use the reference to the implementation for all uses. Whenever required, reflect on the class to find attribute values. -- Happy Hacking, Gaurav Vaish | http://www.mastergaurav.org http://www.edujini.in | http://webservices.edujini.in ------------------- |
|||||||||||||||||||||||