Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

When to use the NEW keyword

$
0
0

Hi all,

Can someone please explain to me in layman's terms (as easy possible) when I should use the New keyword when programming. I am very new to SharePoint development and keep making the mistake of putting the New keyword in when it is not needed and leaving it out when it is needed. I cannot find an explanation on when to use it on the internet.

Lines of code without New key word in:
   var
context = SP.ClientContext.get_current();
   var response = SP.WebProxy.invoke(context, request);

Lines of code with New key word in:

  var query =newCamlQuery();

  var camlQuery =new SP.CamlQuery();

  var data =newDictionaryEntry(item["ID"], item["Title"]);

   var lci =new SP.ListCreationInformation();

I’m sorry if I am asking an easy question, but this will make my programming life much easier if I can get my head around when and when not to use the New keyword.

I hope you can help.
CEStar







Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>