Skip to content

Instantly share code, notes, and snippets.

@danielsimionescu
Created August 28, 2020 09:13
Show Gist options
  • Save danielsimionescu/a79b105827c13c8e5957d2710bde4e34 to your computer and use it in GitHub Desktop.
Save danielsimionescu/a79b105827c13c8e5957d2710bde4e34 to your computer and use it in GitHub Desktop.
Strings in C# - Declaration and Assignment (String.Empty and null)
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