Skip to content

Instantly share code, notes, and snippets.

@JayBazuzi
Last active August 29, 2015 14:19
Show Gist options
  • Save JayBazuzi/4f02815663201cb8bbf5 to your computer and use it in GitHub Desktop.
Save JayBazuzi/4f02815663201cb8bbf5 to your computer and use it in GitHub Desktop.
Using R# 9, uncomment one of the lines below and run Code Cleanup. I get different results depending on which I uncomment.
public class C
{
public void F()
{
}
public static readonly C C1 = new C {S = "sldkfjsldf"};
// public static readonly C C2 = new C {S = C1.S};
// public static readonly C C2 = new C {S = "sdflskdfj"};
public string S;
}
public class C
{
public void F()
{
}
public static readonly C C1 = new C {S = "sldkfjsldf"};
public static readonly C C2 = new C {S = C1.S};
public string S;
}
public class C
{
public static readonly C C1 = new C {S = "sldkfjsldf"};
public static readonly C C2 = new C {S = "sldfksjdflkj"};
public string S;
public void F()
{
}
}
@JayBazuzi
Copy link
Author

In the first case, the fields are all moved to the end of the class; in the second case, they move to the start of the class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment