c# - What method of EF 6 is better to use for get data from database asyn? -


i have next code

public async task<ienumerable<mytabel>> getdata()         {             try             {                 var dbctx = new myentities();                  return await dbctx.mytabel.tolistasync();                 //return await dbctx.mytabel.toarrayasync();             }             catch (exception ex)             {                  throw ex;             }         } 

i wondering tolistasync or toarrayasync method better perfomance ? know ?

thanks.

update

for me perfomance eqval tp less memory usage, faster query times, higher concurrency

tolist() faster toarray(), because array needs copied second time once size known. (unlike list<t>, arrays cannot have space)
same true async versions.

however, may not want function @ all.
unless need of data on client, more efficient use linq entities run sql queries in database.


Comments

Popular posts from this blog

Need help in packaging app using TideSDK on Windows -

java - Why does my date parsing return a weird date? -

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -