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.
このばかげた質問で申し訳ありませんが、最近、C# で文字列または文字列変数を宣言できることがわかりました。特定の状況でどちらが使用されるかなど、それらの違いを知りたいです。助けてくれてありがとう。
Stringクラス名とstringエイリアスに違いはありません。
String
string
私が従った一般的な経験則は、変数を宣言する場合はエイリアスを使用することです。
string foo = "bar";
メソッドを呼び出す場合は、クラス名を使用します
String.IsNullOrEmpty("");
以下も全く同じ」
等