次の例を見てみましょう。
public static class Extensions
{
public static string MakeString(this object obj)
{
if (obj == null) return string.Empty;
return obj.ToString();
}
}
public class ABC
{
public void Method()
{
object obj = default(object);
//Implemention goes here..
// Here every time in step into navigate to MakeString() Method.
if(IsValid(obj.MakeString()))
{
//Operations..
}
}
private bool IsValid(string str)
{
//Check if string is valid or not..
return true;
}
}
この例Extentions
のクラスでは、拡張メソッドがあり、それをクラスABC
で使用しています。この拡張メソッドと他のメソッド呼び出しを使用してステップインするとき、メソッドにステップインするたびMakeString()
にスキップできますか? を使用してmethod attribute
?または他の方法で?