.net

Why do the overloads of String.Format exist?

I was using Reflector to look at the implementation of String.Format and had always been under the impression that the overloads of String.Format that took 1, 2 & 3 arguments were optimized versions of the method that takes an object array. However, what I found was that internally they create an object array and then call a method that ...

How to roll out a custom membership system in asp.net mvc

I've been reading about overriding the Membership Provider and the Role Provider. I think this is what you need to do when doing Asp.net Form projects. Is this also the way to go with Asp.net MVC projects or there is a better way to do so? Thanks :) ...

Auto inject property for register types without DependencyAttribute.

Register<IA, A>(); class B { public IA A {get;set;}} //container inject this property because IA was registered In autofac you can do builder.RegisterType<A>().InjectProperties(); for this. Is there any extension for unity to do this? Or may be extension which I can use as sample for implement this feature by myself? ...

Making an Extension Method Asynchronous

Is there some way I can make an Extension Method asynchronous? I have looked around for a while now, but haven't yet found anything related. Will keep looking though... ...

Versioning issues with assemblies

Let's assume I have two assemblies: MyExecutable.dll version 1.0.0 MyClassLibrary.dll version 1.0.0 Now, MyExecutable.dll currently uses MyClassLibrary.dll's classes and methods (which include some algorithms). Most of those algorithms were made on the run, being that later I'll want to refine them if needed. This means, I won't c...

Processing an XML file removes comments

This snippet <!--Please don't delete this--> is part of my xml file. After running this method, the resulting xml file does not contain this snippet anymore <!--Please don't delete this-->. Why is this? Here's my method: XmlSerializer serializer = new XmlSerializer(typeof(Settings)); TextWriter writer = new StreamWri...

Using Custom Cursor WinForms

Is there a way to use a custom cursor in winforms? There seems to be no option. But when I try to manually add a cursor as a resource, then call it from code, it says that it cannot convert from type byte[] to Cursor. ...

How does the CLR know which if the given assembly is the correct one?

If we have a .NET executable that's using a .NET library, how does the CLR ensure you are using the correct version of the dll? CLRwise what is considered be the "correct dll version", to start with? Does it only look at the version? Looks also at the build-time(?). Maybe it looks at an hash or something? Thanks ...

How can i discover that object is attached to specific Object Context?

if i have 2 objectContexts for the same model each one hold some objects.. How can i find that object is attached to specific Object Context? ...

Adding WPF Text Writer Trace Listener in an Outlook Add In using wpf window/control

I'm working on a outlook 2003 AddIn using VSTO SE.We have few customized windows developed in WPF. It looks there are few client machines have problem with WPF rendering due to which there could be an exception due to addin is getting disabled. I added a outlook.exe.config and added trace listeners for wpf Trace sources. I set it up acc...

Patterns and Libraries for working with raw UI values.

By raw values, I mean the application level values provided by UI controls, such as the Text property on a TextBox. Too often I find myself writing code to check and parse such values before they get used as a business level value, e.g. PaymentTermsNumDays. I've mitigated a lot of the spade work with rough and ready extension methods l...

.NET : Get property name in attribute.

Hi. [MyAttribute()] public string Name { get; set; } In MyAttribute i need to know the name of associated property, is it possible? EDIT: I need to use it in text formatting. ...

Is there a open source .NET CMS that has support for Arabic language?

Is there a open source .NET CMS that has support for Arabic language? Anyone here has an experience with using one? ...

Referencing a x86 assembly in a 64bit one

In one project we have a dependency on a legacy system and its .Net assembly which is delivered as a 'x86' and they do not provide a 'Any CPU' and/or 64bit one. Now the project itself juggles with lots of data and we hit the limitations we have with a forced x86 on the whole project due to that one assembly (if we used 64bit/any cpu it w...

xmlns='' was not expected when deserializing nested classes

I have a problem when attempting to serialize class on a server, send it to the client and deserialize is on the destination. On the server I have the following two classes: [XmlRoot("StatusUpdate")] public class GameStatusUpdate { public GameStatusUpdate() {} public GameStatusUpdate(Player[] players, Command command) ...

How can i learn file name and create a folder?

i try to make TCP/Ip Application to listen any other roemote computer to recieve any file. So i try to get files. i can do that. on the other hand every sample on google about giving SaveDialogBox to recived path folder.Forexample my old server.cs is that: using System; using System.Collections.Generic; using System.ComponentModel; us...

.NET: Start a thread as suspended

In unmanaged code you can create a thread in suspended state. In .NET Framework I can't find this option. Is it because the Thread constructor puts the thread in a suspended state? Is there other reason why this is not supported? ...

Is there a way to put Setter elements inside EventTrigger?

Working on a WPF application, I started working on a custom ControlTemplate. I reached the point where I need to change some control properties when an event occurs. For this purpose, there are Setter elements. Seems all good, but I cannot use them inside EventTrigger elements. For example, if a simple Trigger, that can be bound to cont...

integrating cc.net with uppercut

Hi, I installed uppercut in my system successfully, Then i installed cc.net, for automated build revision number, I followed all the steps in the following site, http://ferventcoder.com/archive/2009/05/21/uppercut---automated-builds---cruisecontrol.net-integration.aspx The same config code in that site i used to integrate but still i c...

How to set full control to a directory??

I am using the following simple code to add full control to a directory, but it doesn't work. String dir_name = @"folder_full_path"; DirectorySecurity dir_security = Directory.GetAccessControl(dir_name); FileSystemAccessRule access_rule = new FileSystemAccessRule(@"AccountName", FileSystemRights.FullC...