开发者

Can Visual Studio track signature changes like Eclipse does

开发者 https://www.devze.com 2023-02-17 20:46 出处:网络
Imagine I have two C# files. The first file, Class1.cs contains namespace CrossReferenceCheckingTest { class Class1

Imagine I have two C# files.

The first file, Class1.cs contains

namespace CrossReferenceCheckingTest
{
    class Class1
    {
        public int doSomething(String s)
        {
            return 0;
        }
    }
}

and then in Class2.cs

namespace CrossReferenceCheckingTest
{
    class Class2
    {
        public void callDoSomething()
        {
            Class1 c1 = new Class1();

            int x = c1.doSomething("asdf");
        }
    }
}

If I change the signature of Class1::doSomething (eg: public String doSomething(int i){}) I will break the code in Class2.cs.

When I'm cutting Java code, the Eclipse editor will underline packages/开发者_C百科classes with a red squiggle.

Is there a way in Visual Studio to see if any files in the project/solution are using the old broken signature?


Visual Studio (2010, at least) will immediately note the breaking change you posit above, underlining the relevant code in Class2 in red, and noting the error in the error list.

If you don't see this underlining, make sure the relevant switches are enabled in Visual Studio's options (VS 2010 again), under Text Editor -> C# -> Advanced:

  • Underline errors in the editor
  • Show live semantic errors

Can Visual Studio track signature changes like Eclipse does

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号