Latest Posts

What is the difference between Load and LoadQuery?

Load LoadQuery
Load method populates the data whatever it gets from the server. LoadQuery method populates the data in completely new object of the type – IEnumerable 
In-place load: Result is loaded in ClientContext itself. Below is the example for the same Query-able Load: Result is NOT loaded in ClientContext. Result is completely a new object of the type IEnumerable.
Below is the example for the same
Example:
Var Lists = ClientContext.Web.Lists;
ClientContext.Load(List);
ClientContext.ExecuteQuery();
Example:
IEnumerable ListCollection = ClientContext. LoadQuery (ClientContext.Web.Lists);
ClientContext.ExecuteQuery();
As the object is loaded into ClientContext, it will be eligible for Garbage Collection only when that ClientContext is out of scope.   The result is loaded in completely new object (IEnumerable ListCollection in above example), so it will be available for Garbage Collection as soon as IEnumerable object goes out of scope.

We value your Feedback:

Page URL:

Name:

 

Email:

 
 

Suggestion:

 

© 2024 Code SharePoint