Questions tagged [.net-4.0]

Version 4.0 of the .NET Framework. Use for questions specifically related to .NET Framework 4.0. For questions on .NET Framework generally, use the .net tag.

Released on April 12th, 2010, version 4.0 (4.0.30319.1) of the Microsoft .NET Framework contains numerous enhancements, new features and bug fixes.

What's New in the .NET Framework 4

Language Improvements

Base Class Library (BCL) additions:

For more information about the new features, see:

8834 questions
53
votes
1 answer

IObservable vs Plain Events or Why Should I use IObservable?

Microsoft introduced the IObservable interface to the BCL with .NET Framework 4, and I thought, "Great, finally, I must use it!" So I dug deep and read posts and documentation and even implemented the pattern. After doing so I've realized that…
Adiel Yaacov
  • 1,401
  • 3
  • 14
  • 24
53
votes
3 answers

What is difference between MemoryCache vs ObjectCache in .net 4.0?

What is difference between .NET framework 4.0 MemoryCache vs ObjectCache? Where to use which object?
Abdul Saboor
  • 4,079
  • 2
  • 33
  • 25
53
votes
3 answers

What is point of SSL if fiddler 2 can decrypt all calls over HTTPS?

I asked a question here a while back on how to hide my http request calls and make them more secure in my application. I did not want people to use fiddler 2 to see the call and set up an auto responder. Everyone told me to go SSL and calls will be…
Landin Martens
  • 3,283
  • 12
  • 43
  • 61
52
votes
10 answers

How do I use GZipStream with System.IO.MemoryStream?

I am having an issue with this test function where I take an in memory string, compress it, and decompress it. The compression works great, but I can't seem to get the decompression to work. //Compress System.IO.MemoryStream outStream = new…
makerofthings7
  • 60,103
  • 53
  • 215
  • 448
51
votes
3 answers

Where's the file-picker dialog in WPF?

http://i.minus.com/i3xuoWZkpfxHn.png I don't see anything that would let me pick files from my computer... there has to be one, where is it? I'm probably missing a reference? Edit: What I had in mind was a textbox with a "Browse" button beside it.…
mpen
  • 272,448
  • 266
  • 850
  • 1,236
51
votes
3 answers

dynamic vs var in C#

Possible Duplicate: What’s the difference between dynamic(C# 4) and var? What is the difference between dynamic and var keyword in .NET 4.0 (VS 2010). As per MSDN, the definition of dynamic is - Dynamic lookup allows you to write method, operator…
Bhaskar
  • 10,537
  • 6
  • 53
  • 64
50
votes
3 answers

foreach + break vs linq FirstOrDefault performance difference

I have two classes that perform date date range data fetching for particular days. public class IterationLookup { private IList items = null; public IterationLookup(IEnumerable items, Func keySelector) …
Robert Koritnik
  • 103,639
  • 52
  • 277
  • 404
50
votes
3 answers

How are .NET 4 GUIDs generated?

I am aware of the multitude of questions here as well as Raymond's excellent (as usual) post. However, since the algorithm to create GUIDs was changed apparently, I found it hard to get my hands on any up-to-date information. The MSDN seems to try…
mafu
  • 31,798
  • 42
  • 154
  • 247
50
votes
10 answers

.NET 4.0 - CultureNotFoundException

I have migrated my ASP.NET MVC 2 project to VS 2010 + .NET 4.0. Now when i start the application i get a lot of "CultureNotFoundException" in IntelliTrace and Output/Gebug window : A first chance exception of type…
Feryt
  • 2,262
  • 2
  • 22
  • 32
49
votes
3 answers

Mixed mode assembly is built against version 'v1.1.4322'

i've included a directX player in c# .net 4.0 app that is included here ( answer2 ) . The problem is that when i try to initialize the object ( i.e. Player mPlayer=new Player()) this error occurs : Mixed mode assembly is built against version…
Alex
  • 10,869
  • 28
  • 93
  • 165
49
votes
9 answers

MSBuild on CI Server can't find AL.exe

I'm having a problem on my TeamCity CI build server where during compilation I get the following error: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2342, 9): error MSB3086: Task could not find "AL.exe" using the…
Tim Long
  • 13,508
  • 19
  • 79
  • 147
49
votes
6 answers

C# How to detect an object is already locked

How can I detect whether an object is locked or not? Monitor.TryEnter (as described in Is there a way to detect if an object is locked?) does not work for me because it locks the object if it is not locked. I only want to check if it is locked and…
hwcverwe
  • 5,287
  • 7
  • 35
  • 63
48
votes
4 answers

lowering priority of Task.Factory.StartNew thread

a code like below will start a new thread to do the job. Is there any way I can control the priority of that thread? Task.Factory.StartNew(() => { // everything here will be executed in a new thread. // I want to set the priority of this…
Moon
  • 33,439
  • 20
  • 81
  • 132
48
votes
5 answers

Dynamically implementing an interface in .NET 4.0 (C#)

With the new dynamic capabilities in .NET 4.0, it seems like it should be possible to dynamically implement an interface, e.g. given: public interface IFoo { string Bar(int baz); } public class Foo : IFoo { public string Bar(int baz) {…
Greg Beech
  • 133,383
  • 43
  • 204
  • 250
47
votes
4 answers

Is there a way to do a PUT with WebClient?

with the WebClient class in .NET 4.0, is there a way to do a PUT? I know you can do a GET with DownloadString() and a POST with UploadString(), but is there a method or property that lets you do a PUT? Thanks.
Him_Jalpert
  • 2,476
  • 9
  • 31
  • 55