Can change your code?

As a young (ish) developer in a solo store, I am very grateful to Resharper as a training tool and mini QA. As the saying goes, can Resharper violate your code in some cases (possibly an edge)?

For example (see below), R # constantly assumes that my →

this. is redundant and catch is redundant

There are other examples, but I do not ask about a specific instance as much as the whole.

Has anyone had an R # break suggestion for their code? If so, then what are they and the mabs for me most important; What can I look for to understand if this really gives me bad advice?

 private void LoadMyForm(DataRow row)
    {

        try
        {
            this.tbxFirstName.Text = row["FirstName"].ToString();
            this.tbxLastName.Text = row["LastName"].ToString();
            tbxMiddleName.Text = row["MiddleName"].ToString();
            tbxPersonID.Text = row["PersonID"].ToString();
            tbxSSN.Text = row["SSN"].ToString();
            tbxEmailAddress.Text = row["EmailAddress"].ToString();
        }
        catch (Exception)
        {
            throw;
        }
    }
+3
source share
12 answers

, Resharper # . R # , , ... .

Resharper, , ( ) , , , .

, , , . , .

, , R # .

, , , , .

+8

, , , 'this' .

, - , , , .

+13

ReSharper . , - , . . , R # , R #.

R # , . ( ):

var submitBtn = (Button)Controls.FindControl(blahblahblah);

R # using. , . , R #, , .

+6

ReSharper ( ). , . , .

, ReSharper -, . ReSharper , catch . , , .

+4

! . , - . , resharper ... , , ! , . resharper !

+3

, , , , - .

- this.something, - , .

, , , - , , . . http://weblogs.asp.net/fmarguerie/archive/2008/01/02/rethrowing-exceptions-and-preserving-the-full-call-stack-trace.aspx

Resharper , . , - , , , , - - , . , , , .

+2

, ReSharper . Howerver, , , . ReSharper .

, , # 3.0 , ReSharper ( Lambda ....).

+1

Resharper, , . :

new string[]{"Some+Nested+Type"}.Select(x => Type.GetType(x)); // this works

Resharper , , :

new string[]{"Some+Nested+Type"}.Select(Type.GetType); // this doesn't work

, Resharper fault, .

+1

, . resharper , . , , :)

0

, - , - , , . , , , , . , .

0

, , :

Foo ThisFoo = new Foo() {Name = Name;}

, , , , , , , .

0

, , , Resharper :

static void A()
{
    B(null);
}

static void B(List<int> list)
{
    C(() => list.Sort());
}

static void C(Action action)
{
}

ReSharper B :

    C(list.Sort);

, - , , System.ArgumentException.

0

Source: https://habr.com/ru/post/1710365/


All Articles