मैंने इस एनोटेशन क्लास को
बनाया है यह उदाहरण समझ में नहीं आता है क्योंकि यह हमेशा एक अपवाद फेंक देगा लेकिन मैं अभी भी इसका उपयोग कर रहा हूं क्योंकि मैं बस यह समझाने की कोशिश कर रहा हूं कि मेरा प्रश्न क्या है। मेरी एनोटेशन किसी भी कारण से किसी भी समाधान के लिए कभी नहीं बुलाया जाता है?सी # - कस्टम एनोटेशन का उपयोग करना?
public class AuthenticationRequired : System.Attribute
{
public AuthenticationRequired()
{
// My break point never gets hit why?
throw new Exception("Throw this to see if annotation works or not");
}
}
[AuthenticationRequired]
private void Window_Loaded(object sender, RoutedEventArgs e)
{
// My break point get here
}
यहाँ की तरह आप तक पहुंचने और उसे पढ़ने के लिए अपने कस्टम एनोटेशन के लिए कैसे है कहना है /z919e8tw.aspx#Y109 –