Take the 2-minute tour ×

I'm upgrading an old C# code-base and would like to convert the regular properties to auto-implemented properties. Can this be done from Visual Studio?

share|improve this question
Warning: If you are using BinaryFormatter to serialize things this will break your serialization code. –  Marc Gravell Jan 31 '11 at 13:13
@TheCloudlessSky no, very much not. Automatically implemented properties get very different field names; BinaryFormatter is a field-based serializer and the field names matter. So if you serialize your data from private int foo; public int Foo {get {return foo;} set {foo = value; } } and then try to deserialize with public int Foo {get;set;} it will go "boom". –  Marc Gravell Jan 31 '11 at 13:19
@Marc - Oops, sorry. Good point. –  TheCloudlessSky Jan 31 '11 at 13:20
add comment

2 Answers

up vote 10 down vote accepted

It is possible using Resharper. You could download a fully functioning trial version for 30 days.

share|improve this answer
Thanks. I was about to try CodeRush. I will check Resharper as well. –  Sriram Jan 31 '11 at 13:21
meh; every time I install it I conclude I don't get much from it and uninstall it again... –  Marc Gravell Jan 31 '11 at 13:21
@Marc - The main benefit I get from it is refactoring, like in this case. I'll remove that bit since it's subjective. –  TheCloudlessSky Jan 31 '11 at 13:22
add comment

I don't think there is a built in method to do this in VS, but you can use tools like ReSharper to do this sort of refactoring.

share|improve this answer
add comment

Your Answer


