C# Reference Guide

Hello World

using System;
using System.Security.Principal;

namespace ref48
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(GetGreeting("Hello World!"));
        }

        static string GetGreeting(string greeting)
        {
            // Summary:
            //  Compilation 1 of 2
            //      C# source code is compiled 
            //      to Common Intermediate Language
            //      (CIL, aka IL, aka MSIL).
            //  Compilation 2 of 2
            //      The Just-in-time (JIT) compiler 
            //      compiles CIL to Native Machine Code
            //      (based on the computer's architecture).
            //  Execution
            //      The Common Language Runtime (CLR)
            //      executes Native Machine Code.
            //  Security & Management
            //      The CLR provides security and memory
            //      management for code it executes.

            try
            {
                return $"{WindowsIdentity.GetCurrent().Name} says {greeting}.";
            }
            catch (Exception ex)
            {
                return ex.Message;
            }
        }
    }
}

Git

  1. https://github.com/raybishun/selfstudy/blob/master/cs/ref/ref48/ref48/Program.cs

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

C# Reference Guide

Hello World

using System;
using System.Security.Principal;
namespace ref48
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(GetGreeting("Hello World!"));
        }
        static string GetGreeting(string greeting)
        {
            // Summary:
            //  Compilation 1 of 2
            //      C# source code is compiled 
            //      to Common Intermediate Language
            //      (CIL, aka IL, aka MSIL).
            //  Compilation 2 of 2
            //      The Just-in-time (JIT) compiler 
            //      compiles CIL to Native Machine Code
            //      (based on the computer's architecture).
            //  Execution
            //      The Common Language Runtime (CLR)
            //      executes Native Machine Code.
            //  Security & Management
            //      The CLR provides security and memory
            //      management for code it executes.
            try
            {
                return $"{WindowsIdentity.GetCurrent().Name} says {greeting}.";
            }
            catch (Exception ex)
            {
                return ex.Message;
            }
        }
    }
}

Git

  1. https://github.com/raybishun/selfstudy/blob/master/cs/ref/ref48/ref48/Program.cs

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s