TtT23
TtT23

Reputation: 7030

Automate changing code from method to property

I'm attempting to clean up a source code written by someone who is proficient at Java but had zero working knowledge in C#.

For now, I'd like to change the get/set methods in data objects into properties with getters and setters. What's a good way to automate such task?

Here's an example. I'd like to change the following line

sPcDataDTO.SetInputTimeString(row["DATA_ITIME"].ToString());

Into this

sPcDataDTO.InputTime = row["DATA_ITIME"].ToString();

Find/Replace won't really work, as the name of the method SetInputTimeString is used in other classes and I also need to remove the extra bracket at the end

Upvotes: 0

Views: 42

Answers (1)

Backs
Backs

Reputation: 24913

You can change your methods one by one with Resharper and his function "Convert method to property". But it can not convert all in once

Upvotes: 1

Related Questions