Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这 4 种方法中哪一种是检查控件文本是否为空性能明智的最有效方法?
someObject.Text != "" someObject.Text != string.Empty someObject.Text.Length != 0 !string.IsNullOrEmpty(someObject.Text)
这就是我们所说的过早优化。
简短的回答:别担心。他们中的任何一个都很好。