A fine site

Checked code , typeof, sizeof

Leave a comment

Overflow is not checked by default
int x=1000000;
x=x*X//-727379968 no error

x=checked(x*x);// System.OverflowException
x=x*x; //System.OverflowException

Overflow check can be turned on with a compiler switch
csc/checked Test.cs

typeof and sizeof
-Returns the type descriptior of given type.
The type decriptor of an object typr can be retrived with o.GetType().

-Returns the size of a type in bytes.
-can only be applied to the valu type.
-Can only be used in unsafe block.



Visibility Modifier
public:- Visible where the declaring the namesapce is known.
-Member of inteface and enumeration are public by default.
-Types in a namesapce (classes, structs, interfaces, enums, delegates)
have default visibility intenal.
private:- only visible in decalring class or struct.
-private is also default modifier (field, method , properties) in a class.



Leave a Reply

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

You are commenting using your 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