.net-4.0

Is it necessary to create ASP.NET 4.0 SQL session state database, distinct from existing ASP.NET 2.0 ASPState DB?

Is the ASP.NET 4.0 SQL session state mechanism backward-compatible with the ASP.NET 2.0 schema for session state, or should/must we create a separate and distinct session state database for our ASP.NET 4.0 apps? I'm leaning towards the latter anyway, but the 2.0 database seems to just work, though I'm wondering if there are any substant...

How to target multiple versions of .NET Framework from MSBuild?

I am improving the builds for an open source project which currently supports .NET Framework v2.0, v3.5, and now v4.0. Up until now, I've restricted myself to v2.0 to ensure compatibility, but with VS2010 I am interested in having real targeted builds. I'm looking for some guidance on how to edit the MSBuild csproj/sln to be able to cle...

C# Conditional Compilation and framework targets

There are a few minor places where code for my project may be able to be drastically improved if the target framework were a newer version. I'd like to be able to better leverage conditional compilation in C# to switch these as needed. Something like: #if NET40 using FooXX = Foo40; #elif NET35 using FooXX = Foo35; #else NET20 using Foo...

What is a practical usage of Code Contracts in .NET 4.0?

In order to fully understand and take advantage of the new features and enhancements provided with the coming of the new .NET Framework 4.0, I would like to get an example of real-world application of the Code Contracts. Anyone has a good example of application of this feature? I would like to get a code sample with a brief explanati...

What is a good practical application example of the Dynamic Language Runtime in .NET 4.0?

I wish to better understand the real-world application of this new feature that consists the Dynamic Language Runtime (DLR). I would like: Brief explanation of how it could be used; A brief sample code that shows how to take advantage of it. Thanks! =) ...

A good practical application of the Covariance and Contravariance in .NET 4.0?

I wish to get acquainted with the recently release of the .NET Framework 4.0 and its Covariance and Contravariance in Generics. Even though I have read what is written at the referenced link, I can't get a grab on how it should be used, and when it shouldn't. A brief explanation and a simple real-world-like code sample is appreciated. ...

What is the benefit and a common real-world practical application of using Tuples in .NET 4.0?

I have read about the Tuples provided with the coming-out of the new .NET Framework features, and still am I wondering about how it could be useful in real-world enterprise applications. Can one give me a brief explanation along with a simple but real-world code sample? Thanks! =) ...

Using .NET 4.0 Task in ASP.NET

Are there any caveats or short comings to using the new Task API in System.Threading.Task in ASP.NET hosted under IIS? I know prior to .NET 4.0 working with any of the ThreadPool actions inside of IIS was always recommended to be avoided. ...

How to see .net library source code with ReSharper 5 and visual studio 2010?

I used to see any .net source code (like System.String) with ReSharper and Visual Studio 2008. since I migrated to Visual studio 2010, this option doesn't give the full source code but just the definitions of the class. How can I fix this, to use the microsoft's symbols server again? Edit: Maybe the problem is only with .net-4.0 assemb...

Foreach loop and tasks.

I know from the codeing guidlines that I have read you should not do for (int i = 0; i < 5; i++) { Task.Factory.StartNew(() => Console.WriteLine(i)); } Console.ReadLine(); as it will write 5 5's, I understand that and I think i understand why it is happening. I know the solution is just to do for (int i = 0; i < 5; i++) { ...

How do I get my non MSTest unit tests running on .net 4.0

Has any of the alt.net unit testing frameworks embraced .net 4.0 framework? ...

How can one manage to fully use the newly enhanced Parallelism features in .NET 4.0?

I am pretty much interested into using the newly enhanced Parallelism features in .NET 4.0. I have also seen some possibilities of using it in F#, as much as in C#. Despite, I can only see what PLINQ has to offer with, for example, the following: var query = from c in Customers.AsParallel() where (c.Name.Contains("customer...

Latest C# and .Net books .

Hi ALl, Can you please name some of latest books to learn C#4.0 and .Net4.0 ? ...

Visual Studio 2010 .NET framework 3.5 unavailable

Hey people, I have installed VS 2010 Professional, and despite my tremendous urge to work on it since it is pleasing to the eye, it seems not to support .NET framework 3.5/3.0. Therefore, I have switched to VS 2008 rather relunctantly. Does anyone know, to add .NET framework 3.0/3.5 to the top right Combo Box within the make new pr...

File.Move does not inherit permissions from target directory?

In case something goes wrong in creating a file, I've been writing to a temporary file and then moving to the destination. Something like: var destination = @"C:\foo\bar.txt"; var tempFile = Path.GetTempFileName(); using (var stream = File.OpenWrite(tempFile)) { // write to file here here ...

parallel.foreach with custom collection

I am extending the System.Net.Mail.MailAddress class to include an ID field, so I created a new custom MailAddress class that inherited from the existing class and a new custom MailAddressCollection class. I then overrode the existing System.Net.Mail.MailMessage.To to use my new collection. I would like to process the recipients in par...

NHibernate and .net-4.0 new ISet<T> collections

I there any new use of the new .net 4 ISet collections with NHibernate? ...

Adding Runtime Intelligence Application Analytics for a library and not an application

I want to add usage statistics for a .NET 4.0 library I write on CodePlex. I try to follow the step described here but my problem lies with the fact that what I write is a library and not an application. One of the steps is put the Setup and Teardown attributes. I thought about adding the Setup attribute on a static constructor or a d...

Is there a free code coverage tool suitable for use with .NET 4 and NUnit?

Is there a free code coverage tool suitable for use with .NET 4 and NUnit that runs from the command line (and is thus suitable for use on a build server)? Please note that any tools that require editions of Visual Studio higher than Professional are not appropriate in this case. I am asking this question because I can't get NCover 1.5...

I can't seem to find System.Collections.Concurrent on VS2010??

I've got VS2010 and im pretty sure .NET 4.0, as if i try to install it from MS it says do i wish to repair the current version- so i must have it. But i want to create a concurrent dictionary and i cant seem to find the correct packet. I went to references to add it manually but it wasnt in my list? ...