4

次の例を見てみましょう。

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?または他の方法で?

4

1 に答える 1

6

これにはDebuggerStepThrough属性を使用できます。

于 2014-05-06T10:57:19.087 に答える