मैं ऐसा करना चाहते हैं, लेकिन यह त्रुटि मिलती:.NET 2.0 में एक्सटेंशन विधियों का उपयोग करना?
Error 1 Cannot define a new extension method because the compiler required type 'System.Runtime.CompilerServices.ExtensionAttribute' cannot be found. Are you missing a reference to System.Core.dll? [snipped some path stuff]
मैं कुछ जवाब यहां का कहना है कि देखा है, तो आप इस खुद के गुण को परिभाषित करने के लिए है।
मैं यह कैसे कर सकता हूं?
संपादित:
[AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)]
public sealed class ExtensionAttribute : Attribute
{
public static int MeasureDisplayStringWidth (this Graphics graphics, string text)
{
}
}
नहीं; आपको * दो * कक्षाओं की आवश्यकता है; विशेषता के लिए एक; विस्तार विधि के लिए एक; अपडेट करूंगी। –