草庐IT

PredefinedStrings

全部标签

C# 静态类与预定义字符串的结构

一位同事刚刚在C#中创建了以下构造(示例代码已简化)。他的目标是缩短代码其余部分中所有预定义字符串的表示法。publicstructPredefinedStrings{publicconststringVeryLongName="VeryLongName";publicconststringAnotherVeryLongName="AnotherVeryLongName";publicconststringTheLastVeryLongName="TheLastVeryLongName";}publicstaticvoidMethodThatUsesTheNames(){Console

C# 静态类与预定义字符串的结构

一位同事刚刚在C#中创建了以下构造(示例代码已简化)。他的目标是缩短代码其余部分中所有预定义字符串的表示法。publicstructPredefinedStrings{publicconststringVeryLongName="VeryLongName";publicconststringAnotherVeryLongName="AnotherVeryLongName";publicconststringTheLastVeryLongName="TheLastVeryLongName";}publicstaticvoidMethodThatUsesTheNames(){Console