Created
August 28, 2020 09:13
-
-
Save danielsimionescu/a79b105827c13c8e5957d2710bde4e34 to your computer and use it in GitHub Desktop.
Strings in C# - Declaration and Assignment (String.Empty and null)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace Strings | |
{ | |
class Program | |
{ | |
private static readonly string _message = "Hello World!"; | |
static void Main(string[] args) | |
{ | |
string name = "Daniel"; | |
string message = _message; | |
string fullName = string.Empty; // "" | |
string middleName = null; | |
Console.WriteLine(name); | |
Console.WriteLine(message); | |
Console.WriteLine(fullName); | |
Console.WriteLine(middleName); | |
Console.ReadKey(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment