コード内のSPSiteのコレクションを検索する最善の方法
質問
私はユーザーがテキストボックス内のデータを入力して送信をクリックし、[送信]をクリックすると、そのURLにこのデータが含まれているすべてのサイトコレクションにTextBoxでは、すべてのサイトを持参するためのLINQクエリを実行します。URLにこのテキストボックスの値が含まれている現在のWebアプリは、これが最良の方法であるかどうかわからない、そして私はこのようにしてすべてのSpsite Disosaleをよく扱うかどうかわからない、私は処分する必要があるかどうかわからないこれらのオブジェクトのもの助け?
解決
You will need to dispose the SPSite objects and write an extension method for that since it is in LINQ. However, you can also achieve your result using foreach
loops instead of LINQ.
See this for more information on using LINQ and SharePoint objects which need to be disposed like SPSite
and SPWeb
:
https://stackoverflow.com/questions/657095/using-linq-with-sharepoint-and-disposing-of-objects http://solutionizing.net/2009/01/05/linq-for-spwebcollection-revisited-assafeenumerable/