.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

use of new() keyword in where function

Posted By: sds     Posted Date: July 04, 2012    Points:5   Category :C#
Please explain why should we use where,new keyword in function

Author: Mohanraj             
Posted Date: July 05, 2012     Points: 20   


New keyword is used as operator and modifier in C#

As operator

it is used as a operator whenever we need to instantiate a new type

whenever a new type is instantiated its corresponding constructor is invoked.

As modifier

it is used to hide an inherited member from the base class member

Author: Sreeraj Nair Mungath             
Posted Date: July 05, 2012     Points: 20   

New is not used just to create objects of a class. It is
also used for Shadowing a method in .NET, which means if
Base class and Derived class have methods with same name
and signature, You can precede the derived class method
name with "new" keyword which makes the method a new one
altogether. This is used in retaining old implementation of
a method and you also want to introduce new implementation
for same method in your assembly

classname a=new classname();

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend