The C# class have 20 properties in string. After some code execution, some of the properties are assgined value. Now I need a Clear()
method to set all of them into string.Empty
. I can write 20 lines of code, just assgin string.Empty
to them one by one. But that will be a lot of lines in the class file.
Is there any good way to do this? Thanks.
CodePudding user response:
Just for a laugh ;)
string1 = string2 = string3 = string4 = string5 = string6 = string7 = string8 = string9 = string10 = string11 = string12 = string13 = string14 = string15 = string16 = string17 = string18 = string19 = string20 = string.Empty;