Soru & Cevap

Sitedeki sorulara cevap verebilmek için giriş yapın ya da üye olun.

Profile picture for user hasankahraman06092
hasankahraman06092
01.11.2022 - 03:09

https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/strings/

-----

You don't use the new operator to create a string object except when initializing the string with an array of chars.

Initialize a string with the Empty constant value to create a new String object whose string is of zero length. The string literal representation of a zero-length string is "". By initializing strings with the Empty value instead of null, you can reduce the chances of a NullReferenceException occurring. Use the static IsNullOrEmpty(String) method to verify the value of a string before you try to access it.

-----

Burada da açıklandığı gibi string bir ifadeyi oluştururken boş olduğunu göstermeniz gerekiyor. Yukarıda Ya "string cevap = null " ya da "string cevap = "" " yapmanız gerekir.

Profile picture for user kubra59
kubra59
21.09.2022 - 02:46

.

Profile picture for user thorinmeekalkan
thorinmeekalkan
20.09.2022 - 05:01

string cevap olarak tanımladığınız değişkende " " şu şekilde bir atama yapabilirsiniz.

almina aygür
22.09.2022 - 12:07

tesekkürlerr

 

Profile picture for user kubra59
kubra59
19.09.2022 - 11:25

.

picture-305923-1601953396.png
muharrir
19.09.2022 - 08:41

12. satırı

string cevap = "";

olarak değiştir.

almina aygür
22.09.2022 - 12:07

teşekkür ederimm