19 Dec: Must Read Codes [1-5]
We are sharing few must read codes/concepts which are required now and then. Each of these codereads doesn’t require a full length descriptive article so combining them into groups of five.
Usage of ‘this’ keyword in C#.
- To qualify members hidden by similar name.
- To have an object pass itself as a parameter to other methods.
- To have an object return itself from a method.
- To declare indexers.
- To declare extension methods.
- To pass parameters between constructors.
- To internally reassign value type (struct) value.
ISNULL and COALESCE though equivalent, can behave differently. An expression involving ISNULL with non-null parameters is considered to be NOT NULL, while expressions involving COALESCE with non-null parameters is considered to be NULL.
string str= (string) strToCast;
string str= strToCast.ToString();
string str= strToCast as string;
Control State maintains the behavior of the controls whereas View State maintains the content of the controls. Also, Control State is available even though View State for the control is disabled.
$(document).ready() occurs when the DOM has been loaded but associated resources like images, flash etc may be pending.
There can be multiple document.ready() in a page but Body.Onload() event will be only one.