Posts tagged "switch"

default keyword in c#

(adsbygoogle = window.adsbygoogle || []).push({}); The “Default” keyword in c# can be used in the following scenarios . The main use of default comes in to picture when used in the generic code. 1. To return Type’s Default Value The Default returns the type’s default value. For the Integer , it returns 0 , for Boolean , it returns false and for the reference types , it returns null int valueI = default(Int32); bool ValueB = default(Boolean); string senthil = default(String); MessageBox.Show(valueI.ToString()) ;// “0” MessageBox.Show(ValueB.ToString()); // “False” MessageBox.Show(senthil); // nothings read more


6 comments - What do you think?
Posted by Ginktage - January 21, 2011 at 9:06 pm

Categories: .NET, C#, Visual Studio, Windows Application   Tags: , , , ,