Alternatives to “ ” for creating strings containing multiple whitespace characters

后端 未结 12 1429
粉色の甜心
粉色の甜心 2020-12-09 15:30

I\'m wondering if there\'s a more OO way of creating spaces in C#.

Literally Space Code!

I currently have tabs += new String(\" \"); and I can\'

12条回答
  •  渐次进展
    2020-12-09 16:31

    There is no reason to do this. All else being equal, smaller code is better code. String.Empty and new String(' ') communicate the same thing as "" and " ", they just take more characters to do it.

    Trying to make it 'more OO' just adds characters for no benefit. Object-Orientation is not an end in itself.

提交回复
热议问题