Written by Mark Pringle | Last Updated on Tuesday, December 06, 2022

C# Programming General Information

C# is a structured object-oriented programming language used to create mobile apps, desktop apps, websites, enterprise software, games, and cloud-based services.

C# code might look like the code below. This is a method used to count the number of characters in a string:

    /// Return the number of characters in a string using. Sequential spaces are not counted.
    /// </summary>
    /// <param name="value">String you want to count chars in.</param>
    /// <returns>Number of chars in string.</returns>
    static int CountChars(string value)
    {
        int result = 0;
        bool lastWasSpace = false;

        foreach (char c in value)
        {
            if (char.IsWhiteSpace(c))
            {
                // A.
                // Only count sequential spaces one time.
                if (lastWasSpace == false)
                {
                    result++;
                }
                lastWasSpace = true;
            }
            else
            {
                // B.
                // Count other characters every time.
                result++;
                lastWasSpace = false;
            }
        }
        return result;
    }

.NET is a framework developed by Microsoft for building and running web applications on Windows. The .NET framework uses the C# programming language. However, it also uses other programming languages like Visual Basic (VB), C++, and F#. There have been many different programming languages used by .NET. C# is just one of the many languages.

In summary, C# is a programming language, while .NET is a framework.

For more information on .NET, see What is .NET Framework on Microsoft's website?