I want to do this, but getting this error:
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]
I have seen some answers here that says, you have to define this attribute yourself.
How do I do that?
EDIT: This is what I have:
[AttributeUsage ( AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method )]
public sealed class ExtensionAttribute : Attribute
{
public static int MeasureDisplayStringWidth ( this Graphics graphics, string text )
{
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…