Ad Code

Responsive Advertisement

System.console.WriteLine

System.console.WriteLine

Console is a predefined class under the base class Libraries which provides standard IO functionality that can be performed on standard IO devises like - keyboard and monitor. The class has a set of static method like- Write, WriteLine, ReadLine etc.

Because the method s are static we don’t required the object of class for Invoking them what we needs only the name of the class.

System is a “Namespace” which is a logical container of types. Logical containers are used in two different cases.

1. To group related items i.e. under base class library we have number of classes that performs related operation .To group all related classes they were put on the separate name spaces.



2. We also used them to overcome the problem with naming collision i.e. defining of multiple classes with the same name can be done by putting them under separate name spaces and then refer the class with name space.

                                  System.Runtime.Remoting.Channel.Tcp;

Importing a Namespace: - 

If at all a class is defined under a Namespace must and should we need to refer the class only with the help on name space in which it was present. This may be a complication if we want to consume the class for multiple times. To overcome the problem you can use the option importing on name space i.e. on the top of the program if we write “using ” within the class we can consume all classes under that Namespace without prefixing it namespace again.


Data types- 

Integer type-


The size of char type has been increased to 2 bytes for providing the support to Unicode  characters i.e. all the languages other than English which are represented with a Unicode value.

String is a variable length type which doesn’t have any fixed size. Its size depends upon the value we assign to it.

Root Type:-
   _______________________________________________________________________
     Object                                                             System.object 
   _______________________________________________________________________
Object type is capable of storing any type of value in it like – Character, Integer, and Float, Boolean etc. it is also variable length type. 

                         [ <> ] [const][read only]<><><= value] [,…n]

int x;

int y = 100;

string S1,S2,S3;

public const float pi=3.14f;

double dd = 324.879;

public readonly decimal d = 456.987m;

modifiers or special keywords like- public , privet, static etc.

Note- the default scope for member of a class in c# is privet.

A constant and read only variable or same which cannot be modified after assign a value. Every numerical value by defoult is considered as int and decimal value is considered as double so to represent a float velue suffices the value f and m for decimal value.
Reactions

Post a Comment

0 Comments