私はこれをしたいが、このエラーを取得:.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]
私はあなたがこの属性を自分で定義する必要があり、言うことここにいくつかの答えを見てきました。
どうすればよいですか?
EDIT:これは私が持っているものですので、同様
[AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)]
public sealed class ExtensionAttribute : Attribute
{
public static int MeasureDisplayStringWidth (this Graphics graphics, string text)
{
}
}
いいえ。あなたは* 2つのクラスが必要です。属性の1つ。 1つは拡張メソッド用です。更新されます。 –