我有一个现有的输入类,是否可以在 C#.net 中为对象添加一个额外的类,而不是执行 if/else 并且首先没有在对象上预设类?
最佳答案
txtField.CssClass = "first_class";
// Output: class="first_class"
txtField.CssClass += " another_class";
// Output: class="first_class another_class"
关于c# - 可以通过 C# 将类添加到对象的现有类属性吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3286783/