c# resharper extract selection to parameterless method in new Class

this is a part of large method

..

...

..

if (hasZeroInput)
{
    file.AppendLine("any string 1");
    file.OpenBracket();
    file.AppendLine("any string 2");
    file.AppendLine();
}

..

....

 

then I select some code and extract to class like this

 

class Writer
{
      public bool hasZeroInput {get;set;}
       public StringBuilder file {get;set;}

       public void Write()
      {
          if (hasZeroInput)
          {
               file.AppendLine("any string 1");
               file.OpenBracket();
               file.AppendLine("any string 2");
               file.AppendLine();
          }
       }
}

 

I think this is a good future.

Are you planning future like this ?

Please sign in to leave a comment.