Tuesday, March 9, 2010

LINQ let Keyword

How can I miss that! :)

I have been working with LINQ for almost 2 years, and I've never noticed the new keyword "let" which is used inside LINQ queries to create temporarily variables.

var list = new List() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
var query = from i in list
let j = i + 2
let k = j * j
select new { i, j, k };

You can see the let keyword was used to create two new temp variables (j, k) which their values were calculated inside the query.

Looks nice, doesn't it!!

Could not load file or assembly or one of its dependencies. Access is denied" Error

Recently, I have installed Windows7 and configured one project from my friend's pc on my machine and I have faced this problem.

I have found solutions that works are,

Go to "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files" ( Modify the framework version, root directory etc according to your environment.)

Now, right-click and open up the Security tabs for this folder. Grant "Full control" to the 'users' group. However, it this is a security problem for your environment to grant full control to all users in Users group

If you don't find this folder, you need to register ASP.NET on IIS.
You can do so by opening VS Command promot and type aspnet_regiis.exe -i

Another Solution could be to put the concerned assemblies lo GAC.

I think this problem exists for pcs with fresh installation.