function ClearAll()
{
for (i=0; i0].length; i++)
{
doc = document.forms[0].elements[i];
switch (doc.type)
{
case "text" :
doc.value = "";
break;
case "checkbox" :
doc.checked = false;
break;
case "radio" :
doc.checked = false;
break;
case "select-one" :
doc.options[doc.selectedIndex].selected = false;
break;
case "select-multiple" :
while (doc.selectedIndex != -1)
{
indx = doc.selectedIndex;
doc.options[indx].selected = false;
}
doc.selected = false;
break;
default :
break;
}
}
}
}
Wednesday, March 17, 2010
Sunday, March 14, 2010
New Features in .Net 4.0
.Net 4 has introduced some exciting new features. Here are some of them listed below. I will take an overview of these (which i have used) features as c# developer
.Net 4 has introduced some exciting new features. Here are some of them listed below. I will take an overview of these (which i have used) features as c# developer
Dynamic Lookup (New to C#)
C# added a new static type named dynamic. Although there is a lot that goes into making this new type work, but using it is eady. You can think of the dynamic type as an object that supports late bindingdynamic Car = GetCar(); //Get a reference to the dynamic object
Car.Model = "Mondeo"; //Assign a value to a property (also works for fields)
Car.StartEngine(); //Calling a method
Car.Accelerate(100); //Call a methods with parameters
dynamic Person = Car["Driver"]; //Getting with an indexer
Car["Passenger"] = CreatePassenger(); //Setting with an indexer
Named and Optional Parameters (New to C#)
Named parameters were in VB only, and now are finally being incorporated into C#. As the name suggests, optional parameters are parameters that you can (have option) to pass into a method or constructor. If you opt not to pass a parameter, the method simply uses the default value defined for the parameter. To make a method parameter optional in C#, you just give it a default value
public void CreateBook(string title="No Title", int pageCount=0, string isbn = "0-00000-000-0")
{
this.Title = title;
this.PageCount = pageCount;
this.ISBN = isbn;
}
Subscribe to:
Posts (Atom)