All Questions
            193
            questions
        
        
            184
            votes
        
        
            19
            answers
        
        
            92k
            views
        
    Cleaner way to do a null check in C#? [duplicate]
                Suppose, I have this interface,
interface IContact
{
    IAddress address { get; set; }
}
interface IAddress
{
    string city { get; set; }
}
class Person : IPerson
{
    public IContact contact { ...
            
        
       
    
            88
            votes
        
        
            6
            answers
        
        
            138k
            views
        
    Is it possible to run a .NET 4.5 app on XP?
                First, I have read the following:
Connect case
VS case
and especially this channel9 post
So, from the last bullet, I really think there is no way around this, but I had to see if I could get a ...
            
        
       
    
            87
            votes
        
        
            5
            answers
        
        
            182k
            views
        
    Differences between .NET 4.0 and .NET 4.5 in High level in .NET
                Eager to know Differences between .NET 4.0 and .NET 4.5 in High level in .NET and also differences in ASP.NET, C# also in these frameworks
            
        
       
    
            69
            votes
        
        
            2
            answers
        
        
            45k
            views
        
    Does C# 7.0 work for .NET 4.5?
                I created a project in Visual Studio 2017 RC to check whether I can use new C# 7.0 language features in a .NET Framework 4.5 project. It seems to me that after referencing System.ValueTuple NuGet, new ...
            
        
       
    
            66
            votes
        
        
            10
            answers
        
        
            120k
            views
        
    Is that possible to send HttpWebRequest using TLS1.2 on .NET 4.0 framework
                My application connects to Experian server and Experian will soon stop supporting TLS 1.0 and TLS 1.1. All connectivity using HTTPS must use TLS Version 1.2.
I want to do some research on that issue ...
            
        
       
    
            35
            votes
        
        
            3
            answers
        
        
            21k
            views
        
    Does .net 4.5 work side by side with .net 4.0?
                I am interested in installing the .NET 4.5.
But I have heard that it is an In-Place upgrade.
Since the users at my company uses Windows XP. I can't release any client side apps that use .NET 4.5.
I ...
            
        
       
    
            26
            votes
        
        
            6
            answers
        
        
            5k
            views
        
    Behaviour of List<T>.Sort in .NET 4.5 changed from .NET 4.0?
                I have the following test inside a project targeting .NET 4.0:
[TestFixture]
public class Donkey
{
    [Test]
    public void TestListSorting()
    {
        var expected = new[]
                    {...
            
        
       
    
            20
            votes
        
        
            1
            answer
        
        
            6k
            views
        
    How to access a security critical field from an anonymous delegate or lambda?
                Scenario
Let's say we've the next code:
[SecuritySafeCritical]
public void SomeMethod()
{
    SomeCriticalClass critical = new SomeCriticalClass();
    Action someDelegate = () => 
    {
        ...
            
        
       
    
            19
            votes
        
        
            3
            answers
        
        
            17k
            views
        
    Timeout.InfiniteTimespan in .Net 4.0?
                I actually do know that Timeout.InfiniteTimespan does not exist in .NET 4.0.
Noticed, there's also Timeout.Infinite which does exist in .NET 4.0
I am calling those two methods:
// the Change-Method
...
            
        
       
    
            17
            votes
        
        
            3
            answers
        
        
            14k
            views
        
    Why does Task.Delay() allow an infinite delay?
                After my application froze I tracked down the cause to a thread waiting on a task created by Task.Delay() (or TaskEx.Delay() in .NET 4.0) for which it provided a computed TimeSpan that, due to a bug, ...
            
        
       
    
            16
            votes
        
        
            3
            answers
        
        
            7k
            views
        
    .NET 4 equivalent of Task.WhenAll()
                In .NET 4, is there any functional equivalent to .NET 4.5's System.Threading.Tasks.Task.WhenAll()?
The goal is to wrap up multiple async tasks into a single one that is completed when all of its ...
            
        
       
    
            16
            votes
        
        
            5
            answers
        
        
            35k
            views
        
    visual studio 2013 on windows xp
                Is it possible to run Visual Studio 2013 on Windows XP?
I heard that it is not possible to install .NET Framework 4.5 on Windows XP. What if I want to use Visual Studio 2013 for .NET 4.0 on Windows ...
            
        
       
    
            15
            votes
        
        
            1
            answer
        
        
            9k
            views
        
    Loading an assembly targeted for .NET 4.5 on a .NET 4.0 app domain
                Assuming the system has .NET 4.0 and .NET 4.5 installed.
Is it possible to load and work with a .NET 4.5 assembly from an assembly written targeting .NET 4.0?
Simply put, can I call Assembly.Load ...
            
        
       
    
            14
            votes
        
        
            2
            answers
        
        
            14k
            views
        
    Supported runtime v4.0 in app.config after upgrading VS11 Beta to VS2012 RC
                After upgrading from VS11 Beta to VS2012 RC - I've modified from targeting .NET 4.0 to .NET 4.5. I notice in app.config following section
<startup>
    <supportedRuntime version="v4.0" sku="....
            
        
       
    
            14
            votes
        
        
            2
            answers
        
        
            9k
            views
        
    Does installing .NET 4.5 REALLY replace .NET 4.0 assemblies?
                I am now officially confused. The MSDN article on installing the .NET 4.5 framework states the following:
"The .NET Framework 4.5 replaces the .NET Framework 4. When you install the .NET Framework 4....
            
        
       
    
            13
            votes
        
        
            3
            answers
        
        
            4k
            views
        
    Delay property on Binding from .Net 4.5 in .Net 4.0
                How can I implement Delay property from .Net 4.5 (described here) on binding in .Net 4.0?
I know I cannot inherit from BindingBase as ProvideValue is sealed. 
I could implement MarkupExtension but ...
            
        
       
    
            13
            votes
        
        
            5
            answers
        
        
            11k
            views
        
    Targeting .NET Framework 4 when Framework 4.5 is installed
                I have VS2010 and VS2012 installed on my computer and had the .NET Framework 4.0 which I then upgraded to .NET Framework 4.5.  However, I am still developing apps that need to work on .NET Framework 4....
            
        
       
    
            12
            votes
        
        
            4
            answers
        
        
            2k
            views
        
    What .NET 4.5 (or earlier) higher-level constructs make Threading easier?
                Delegates are a few of the objects that make threading easier in .NET reference. They can be used to asynchronously invoke a method. What other objects exist in framework 4.5 (or earlier) that make ...
            
        
       
    
            11
            votes
        
        
            3
            answers
        
        
            39k
            views
        
    .NET Framework 4.0 does not install when 4.5 is already installed
                I use Visual Studio 2012 for a WPF project needing (at least) .NET Framework 4.0. 
I have 4.5 already installed, but people with Windows XP cannot install the application (because 4.5 does not ...
            
        
       
    
            11
            votes
        
        
            2
            answers
        
        
            5k
            views
        
    Can a Task have multiple awaiters?
                I am toying around with an async service for a Windows 8 project and there are some async calls of this service, which should only be called once at a time. 
 public async Task CallThisOnlyOnce()
 {
 ...
            
        
       
    
            10
            votes
        
        
            5
            answers
        
        
            12k
            views
        
    Visual Studio 2012 missing frameworks
                I have installed Visual Studio 2012 today, and i was excited, because i wanted to experiment with the latest framework version (.net 4.5). But it seems like Visual Studio 2012 doesnt show .net 4.0 and ...
            
        
       
    
            9
            votes
        
        
            3
            answers
        
        
            3k
            views
        
    When exactly does .NET Monitor go to kernel-mode?
                I would like to compile a list of all possible conditions making Monitor go to kernel-mode or use a kernel sync object.
The sync block has a field to reference the kernel object. Hence I deducted that ...
            
        
       
    
            9
            votes
        
        
            1
            answer
        
        
            5k
            views
        
    Can a build server with .NET 4.5 installed successfully deploy a project targeting 4.0 to a server with only .NET 4.0 installed?
                We've recently installed .NET 4.5 onto our continuous integration build server so that it can support new projects that utilize features of .NET 4.5. This build server is also used to build and deploy ...
            
        
       
    
            9
            votes
        
        
            1
            answer
        
        
            2k
            views
        
    Difference in sorting between .NET 3.5 and .NET 4.0
                I've come across a very weird behaviour of the .NET framework(s), when sorting a collection.
This behaviour is different between .NET 3.5 and 4.0 (but I think I know why), but more importantly (and ...
            
        
       
    
            9
            votes
        
        
            2
            answers
        
        
            2k
            views
        
    visual studio debug fatal error 0x8007000e with .NET 4.5 while debugging .NET 4.0 application
                After installing VS2012 and .NET 4.5 both Visual Studio 2010 and 2012 started hanging when debugging our application with a fatal error 0x8007000e. I know this error means the process is out of memory ...
            
        
       
    
            9
            votes
        
        
            4
            answers
        
        
            13k
            views
        
    Msbuild fails with error msb4064 and msb4063
                After installing Visual Studio 2012 with .NET 4.5 I started to get the following errors while building using msbuild:
error MSB4064: 
  The "SdkToolsPath" parameter is not supported by the "...
            
        
       
    
            8
            votes
        
        
            1
            answer
        
        
            1k
            views
        
    Assembly.LoadFrom BadImageFormatException - different behavior in .NET 4.0 and 4.5 (possibly undocumented)
                According to MSDN documentation, 
public static Assembly LoadFrom(string assemblyFile)
throws BadImageFormatException if
assemblyFile is not a valid assembly.
-or-
Version 2.0 or later of the ...
            
        
       
    
            7
            votes
        
        
            2
            answers
        
        
            1k
            views
        
    Target .net 4.5 but deploy to .net 4.0 is it possible?
                I have to work under the following policy "all software must be 1 version behind", I don't particularly like this and I cant change it.  so that would mean that our production machine will only go as ...
            
        
       
    
            7
            votes
        
        
            3
            answers
        
        
            4k
            views
        
    Nant build using .NET 4.5 (Beta) assembly references despite specifying "net-4.0"
                After installing .Net 4.5 Beta, the output of my Nant build fails with: 
"could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=...
            
        
       
    
            7
            votes
        
        
            2
            answers
        
        
            9k
            views
        
    GetSystemMetrics() returns different results for .NET 4.5 & .NET 4.0
                During a .NET 4.0 -> .NET 4.5 application migration process I've discovered an extremely strange behavior. I've been able to track this issue down to this short code snippet:
class Program
{
    [...
            
        
       
    
            7
            votes
        
        
            1
            answer
        
        
            413
            views
        
    What other silent changes did happen from .Net Frameworkf v.4.0 to 4.5? [closed]
                We want to switch to .net 4.5 cause it offers many improvements.
But...sometimes I found some tricky details about not trivial changes in the framework.
Lets look for TPL unobserved exception ...
            
        
       
    
            7
            votes
        
        
            2
            answers
        
        
            12k
            views
        
    CRM Plugin: Custom Exception in Sandbox
                I have a Dynamics CRM 2013 plugin executing in the Sandbox.
This code has the following custom exception class:
    [Serializable]
    public class PluginValidationException : Exception
    {
       ...
            
        
       
    
            7
            votes
        
        
            1
            answer
        
        
            486
            views
        
    SvcUtil /edb doesn't generate INotifyPropertyChange when DotNET 4.5 is installed
                All of the dev computers here but one has DotNET 4.5 installed. The last one has 4.0 installed. Only the one with 4.0 generates proxy classes that implements INotifyPropertyChange, all other computers ...
            
        
       
    
            6
            votes
        
        
            2
            answers
        
        
            2k
            views
        
    How to identify that an assembly has been compiled with/for .NET 4.5, as opposed to .NET 4.0?
                I have some build agents that is building .NET code for us through a TeamCity setup, and I'm beginning to wonder if despite the project settings, they're outputting .NET 4.5 built assemblies. My ...
            
        
       
    
            6
            votes
        
        
            2
            answers
        
        
            10k
            views
        
    Getting AddressAlreadyInUseException after upgrading to .NET 4.5
                I recently installed the new .NET Framework 4.5 (previously was 4.0 installed) on my Server and I´m getting a System.ServiceModel.AddressAlreadyInUseException when I start my Windows Service that ...
            
        
       
    
            6
            votes
        
        
            3
            answers
        
        
            11k
            views
        
    Downgrade code of HttpClient .NET 4.5 to .NET 4.0
                I have this code that is working fine in .NET 4.5.
var handler = new HttpClientHandler();
handler.UseDefaultCredentials = true;
handler.PreAuthenticate = true;
handler.ClientCertificateOptions = ...
            
        
       
    
            6
            votes
        
        
            1
            answer
        
        
            5k
            views
        
    Can application built with .NET 4.5 run on .NET 4.0?
                My project is targeting to .NET 4.5. It doesn't use any new 4.5 methods, so it actually works fine on the machine with only .NET 4.0 installed.
This is all good until I added some extension methods ...
            
        
       
    
            6
            votes
        
        
            4
            answers
        
        
            6k
            views
        
    System.Tuple defined in multiple assemblies
                I just installed VS 11 within Windows 8. When I got the latest of a solution built with VS 2010, then built it, I'm getting this error (in VS 11):
  The predefined type 'System.Tuple' is defined in ...
            
        
       
    
            6
            votes
        
        
            1
            answer
        
        
            3k
            views
        
    Should I upgrade to be able to use the new async methods for SqlDataReader?
                I'm working on a large project that runs on .NET 4.0. This framework uses ADO.NET for database calls and we're currently adding asynchronous API methods. The SqlCommand class has the APM methods ...
            
        
       
    
            5
            votes
        
        
            3
            answers
        
        
            4k
            views
        
    Website upgraded to MVC 5 has missing DisplayMode property on ControllerContext
                I recently updated my website to MVC 5. It ran well on my dev machine. when I moved to staging on shared hosting supporting .Net 4.0 where my MVC 4 site worked just fine. After deployment I received ...
            
        
       
    
            5
            votes
        
        
            4
            answers
        
        
            15k
            views
        
    Development for .NET 4.0 (Windows XP) with Visual Studio 2012
                .NET 4.5 is an in-place-upgrade and therefore replaces .NET 4.0. Consequently when I install .NET 4.5 with Visual Studio 2012 I can no longer develop applications for .NET 4.0. 
As .NET 4.5 is not ...
            
        
       
    
            5
            votes
        
        
            1
            answer
        
        
            4k
            views
        
    Is CancellationTokenSource.CancelAfter() leaky?
                The release of the Async Targeting Pack prompted me to use ILSpy to have a look at what Task-based Asynchronous Pattern (TAP) extension methods were provided there (some of which I have already ...
            
        
       
    
            5
            votes
        
        
            4
            answers
        
        
            2k
            views
        
    How to make Sequential Processing as simple as Parallel Processing
                I've got two .net Task objects that I may wish to run in parellel or in sequence.  In either case, I don't want to block a thread to wait for them.  As it turns out, Reactive Extensions make the ...
            
        
       
    
            5
            votes
        
        
            1
            answer
        
        
            2k
            views
        
    Compile .net 4.0 project on build server with .net 4.5
                We're having the seemingly common error
Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=...
            
        
       
    
            5
            votes
        
        
            1
            answer
        
        
            1k
            views
        
    Has extending static classes using extension methods been made possible in .NET 4.0+?
                I have read that it is possible to extend static classes in F#, though it was not yet possible in C#. Multiple workarounds are proposed and therefore suggesting that this type of extension could be ...
            
        
       
    
            5
            votes
        
        
            0
            answers
        
        
            3k
            views
        
    Does SmtpClient support international email addresses (IDN/Intl email) in .Net 4.0?
                In .Net 4.5 SmtpClient have public property DeliveryFormat which accepts values of the System.Net.Mail.SmtpDeliveryFormat type. So I can assign DeliveryFormat value SmtpDeliveryFormat.International ...
            
        
       
    
            5
            votes
        
        
            3
            answers
        
        
            2k
            views
        
    Missing Frameworks after installing VS 2012 [closed]
                So I have two machines I have installed 2012 on and they do not have identical frameworks installed on them the correct one looks like this
Machine A Screenshot:
But the incorrect one looks like ...
            
        
       
    
            4
            votes
        
        
            4
            answers
        
        
            11k
            views
        
    .NET 4.0 substitutes for .NET 4.5 namespaces
                There is some code for an MVC application which was built using .NET 4.5 as a framework in VS 2012. My current system forces me to work on VS 2010. I managed to open the VS2012 solution in my VS2010, ...
            
        
       
    
            4
            votes
        
        
            1
            answer
        
        
            308
            views
        
    Method with no parameters in c# and still a method?
                All i am trying to do is to check whether all elements of list B are in list A
        if (listA.All(element => listB.Contains(element))
        {
            return;
        }
Someone came up ...
            
        
       
    
            4
            votes
        
        
            2
            answers
        
        
            3k
            views
        
    'System.Guid' is not an attribute class
                I am creating a new dll application with Visual Studio 2013 based on .net 4.5.
When trying to define the Guid attribute on my class like this: 
[Guid("4245366B-0484-4A41-A2E8-C7D9FC3A4ED7")]
The ...