Replacing code.
from simple data holder to wrapper of dictionary.
simple data holder:
After some code refactoring, all data stored in Dictionary, and data holder look like this:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private class DataHolder | |
{ | |
public int SomeData { get; set; } | |
public string NameOfData { get; set; } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private class DataHolder | |
{ | |
public int SomeData { get { return dict.GetValue("SomeData"); } set { dict.SetValue("SomeData", value); } } | |
public string NameOfData { get { return dict.GetValue("NameOfData"); } set { dict.SetValue("NameOfData ", value); } } | |
} |
To replace all values (30) data values, i use visual studio find and replace capability to use regular expression.
This is value of find:
(\w*) (\w*)\s{ (get;) (set;) }
This is value of replace.
$1 $2 { get { return dict.GetValue<$1>("$2");} set { dict.SetValue("$2",value); } }
No comments:
Post a Comment