Monday 9 December 2019

C# Session 3: Keywords in C#

Keywords in C#


C#.Net has some pre-defined reserved words called as Keywords, which can’t be used as Identifiers for variable, class, interface, properties etc…

Keywords has been categorized based on the type of use.


Of Type Modifiers:


Below are some modifiers which has a meaning to get modified where these are applied. It states that it allows or restricts programs/sub-programs being modified by another set of execution step/code.

                   abstract                partial
                   async                   readonly
                   const                    sealed
                   event                    static
                   extern                  unsafe
                   new                      virtual
                   override               volatile
                   const

Of Type Access Modifiers:


Access specifiers are those keywords being used with classes, methods, properties, 
interface, fields etc… to control the accessibility for that particular block/constraint 
and enables security as well.

                   public                  internal
                   private                 protected

Of Type Template:


These are the keywords usually part of a program in a sequential flow.

                   if                       in
                   else                   continue
                   do                     break
                   switch               default
                   case                  goto
                   for                    return
                   foreach             yield
                         fixed                 lock
                         unchecked        checked
                         while 
 

Of Type Method Parameters:


These keywords generally used in methods with its parameters.

                   params                ref
                         out

Of Type Namespace:


These are the keywords usually applies to namespace while importing.

             using                . operator
                   :: operator        extern alias

Of Type Access Keywords:


These keywords used to access objects/components in class or from base clases.

                   base                this

Of Type Operators:


This type of keywords performs miscellaneous actions.

                   as                     sizeof
                         await                typeof
                         new                  stackalloc
                         is                      unchecked
                         checked

Of Type Literal:


These type of keywords deals with current instance or value of an object.

                   null                 value
                         false                void
                   true                 

Of Type Contextual:


These type of keywords to be considred as keywords in certain conditions. It can be 
used as identifiers and doesn’t turns into blue color.

                   add                 value
                         var                  global                   
                         dynamic         set

Of Type Query:


These keywords are contextual keywords especially used in query using Linq.

                   from                  join
                   where                let
                   select                 in
             group                on
             into                   orderby

Type Keyword:


These are data types we have in C#.

                   bool                      in
                   byte                      long
                   char                      sbyte
                   class                     short
                   decimal                string
                   double                  struct
                   enum                    uint
                         float                      ulong
                         ushort

No comments:

Post a Comment

Angular 8 Session 21 - ngFor Directive In Angular

ngFor Directive Content will be resume soon. Stay tuned!