Followers

Total Pageviews

Translate

Wednesday, November 13, 2019

C#

C#

  • C# is a general-purpose, multi-paradigm programming language encompassing strong typing, lexically scoped, imperative, declarative, functional, generic, object-oriented, and component-oriented programming disciplines.
  • Family :C
  • Designed & Developer by Microsoft
  • First appeared 2000
  • Website : https://docs.microsoft.com/en-us/dotnet/csharp/index

Advantage of C#


  • Object- Oriented Language. C# is pure object-oriented language, this allows you to create modular maintainable applications and reusable codes. ...
  • Automatic Garbage Collection. ...
  • No Problem if Memory Leak. ...
  • Easy-to-Development. ...
  • Cross Platform. ...
  • Better Integration. ...
  • More Legible Coding. ...
  • Scarcity of Choice.

Disadvantage of C#


  • It has no security.
  • Complex in a very large high-level program.
  • Used for platform specific application commonly.
  • For a particular operating system or platform, the library set has usually chosen that locks.
  • When C++ used for web applications complex and difficult to debug.
  • C++ can't support garbage collection.

Features of C#


  • Simplicity. All the Syntax of java is like C++. ...
  • Consistent Behavior. C# introduced a unified type system which eliminates the problem of varying ranges of integer types. ...
  • Modern Programming Language. ...
  • Pure Object-Oriented Programming Language. ...
  • Type Safety. ...
  • Feature of Versioning. ...
  • Compatible with other Language. ...
  • Inter-operability.


Structure of C#



using System;
namespace YourNamespace
{
    class YourClass
    {
    }
    struct YourStruct
    {
    }

    interface IYourInterface 
    {
    }

    delegate int YourDelegate();

    enum YourEnum 
    {
    }

    namespace YourNestedNamespace
    {
        struct YourStruct 
        {
        }
    }

    class YourMainClass
    {
        static void Main(string[] args) 
        {
            //Your program starts here...
        }
    }
}



Example of C#


using System;

class HelloWorld {
static void Main() {
//print text without inserting new line after the message
Console.Write("Hello World,");
Console.Write("How are you?");
//print new line
Console.WriteLine();
//print text with new line after the message
Console.WriteLine("Hello World");
Console.WriteLine("How are you?");
//print new line using escape sequence just like C language
Console.WriteLine("Hello World\nHow are you?");
}
}

O/P : 
                     Hello World,
                     How are you?
                     Hello World
                     How are you?
                     Hello World
                   How are you?



Keywords of C#

  • abstract
  • as
  • base
  • bool
  • break
  • byte
  • case
  • catch
  • char
  • checked
  • class
  • const
  • continue
  • decimal
  • default
  • delegate
  • do
  • double
  • else
  • enum
  • event
  • explicit
  • extern
  • false
  • finally
  • fixed
  • float
  • for
  • foreach
  • goto
  • if
  • implicit
  • in
  • int
  • interface
  • internal
  • is
  • lock
  • long
  • namespace
  • new
  • null
  • object
  • operator
  • out
  • override
  • params
  • private
  • protected
  • public
  • readonly
  • ref
  • return
  • sbyte
  • sealed
  • short
  • sizeof
  • stackalloc
  • static
  • string
  • struct
  • switch
  • this
  • throw
  • true
  • try
  • typeof
  • unit
  • ulong
  • unchecked
  • unsafe
  • ushort
  • using
  • using static
  • virtual
  • void
  • volatile
  • while

No comments:

Post a Comment