Why we use New keyword in every object C# [Resolved]

Posted by Priyankapandit under C# on 11/22/2017 | Points: 10 | Views : 308 | Status : [Member] | Replies : 1
I am little bit confused in

why we using (new) keyword in every object in c#

Thanks in advance




Responses

Posted by: Dharmraj on: 11/22/2017 [Member] Starter | Points: 50

Up
0
Down

Resolved
It is used to create instances of anonymous types.

The new operator is also used to invoke the default constructor for value types.

The new operator cannot be overloaded.

If the new operator fails to allocate memory, it throws the exception, OutOfMemoryException.

Also Refer this...
http://www.c-sharpcorner.com/UploadFile/dacca2/memory-allocation-using-new-operator-in-C-Sharp/

Dharmraj Thakur

Priyankapandit, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response