.net

How to render a control to look like ComboBox with Visual Styles enabled?

I have a control that is modelled on a ComboBox. I want to render the control so that the control border looks like that of a standard Windows ComboBox. Specifically, I have followed the MSDN documentation and all the rendering of the control is correct except for rendering when the control is disabled. Just to be clear, this is for a s...

HSL in .net

What tools have you used for working with HSL colors in .net?...

What are the best practices for using Extension Methods in .Net?

I have seen these being used every which way, and have been accused of using them the wrong way (though in that case, I was using them that way to demonstrate a point). So, what do you think are the best practices for employing Extension Methods? Should development teams create a library of extension methods and deploy them across vari...

Why can't I have abstract static methods in c#?

I've been working with providers a fair bit lately and I came across an interesting situation where I wanted to have an abstract class that had an abstract static method. I read a few posts on the topic and it sort of made sense, but I was wondering if someone here might be able to offer a nice clear explanation?...

What are your favorite .NET Object Relational Mappers (ORM)?

What sort of Object Relational Mapping (ORM) systems do you use on various projects? What scale is the project? What features do you use and look for in an ORM? ...

Using SQLite with Visual Studio 2008 and Silverlight

Any one know decent way to reference a SQLite database using the above mentioned tools? I tried using ODBC (the SQLite driver) but while the connection is good, I get no data returned. Like I can't see any tables in Data Connection (VS 2008). Is there a better way? Edit: corrected typos...

Best way to get InnerXml of an XElement?

What's the best way to get the contents of the mixed "body" element in the code below? The element might contain either XHTML or text, but I just want its contents in string form. The XmlElement type has the InnerXml property which is exactly what I'm after. The code as written almost does what I want, but includes the surrounding <bo...

What Are Some Good .NET Profilers?

What profilers have you used when working with .net programs, and which would you particularly recommend?...

What's the best way to find long-running code in a Windows Forms Application

I inherited a Windows Forms app written in VB.Net. Certain parts of the app run dreadfully slow. What's the easiest way to find which parts of the code are holding things up? I'm looking for a way to quickly find the slowest subroutines and tackle them first in an attempt to speed up the app. I know that there are several code profil...

Long-time LAMP Developer moving to VB.NET

I've been developing with PHP5/MySQL for years, but recent circumstances have pushed me to move towards the .NET platform. I'd be interested to hear any advise from someone who has gone through this transition... What are some things you wish you knew when you started? I also have a Java background so I'm not scared of the OO aspect ...

TestDriven.NET is not running my SetUp methods for MbUnit

I've created some MbUnit Test Fixtures that have SetUp methods marked with the SetUp attribute. These methods run before the tests just fine using the MbUnit GUI, the console runner, and the ReSharper MbUnit plugin. However, when I run the tests with TestDriven.NET it does not run the SetUp methods at all. Does anyone know if this i...

Why use .NET?

I've often wondered, what is so great about .NET and MsSQL? I can see a downside being that you have to run it on Windows but I am unaware of any upsides besides it being quite fast, yet so many here use it. Edit: You are meant to run it on Windows but as Atrophius pointed out you can use Mono ...

How do I add SSL to a .net application that uses httplistener - it will *not* be running on IIS

Most recent edits in bold I am using the .net HttpListener class, but I'm won't be running on IIS and am not using ASP.net. This web site describes what code to actual use to implement SSL with asp.net and this site describes how to set up the certificates (although I'm not sure if it works only for IIS or not). When I the class docu...

Best way to cache data in .NET

I am in the process of figuring out a cache strategy for our current setup, currently have multiple web servers and wanted to know what is the best way to cache data in this environment. I have done research about MemCache and the native asp.net caching but wanted to get some feedback first. Should I go with a Linux box if I use MemCache...

ConfigurationManager.AppSettings Performance Concerns

I plan to be storing all my config settings in my application's app.config section (using the ConfigurationManager.AppSettings class). As the user changes settings using the app's UI (clicking checkboxes, choosing radio buttons, etc.), I plan to be writing those changes out to the AppSettings. At the same time, while the program is runni...

C#: Accessing a Dictionary.Keys Key through a numeric index

I'm using a Dictionary<string, int> where the int is a count of the key. Now, I need to access the last-inserted Key inside the Dictionary, but i do not know the name of it. The obvious attempt: int LastCount = mydict[mydict.keys[mydict.keys.Count]]; does not work, because Dictionary.Keys does not implement a []-indexer. I just wonde...

Grid Hosting for Windows

Are there any good grid-hosting companies out there that offer .NET stacks? Something like MediaTemple - which won't host the worlds fastest websites, but for the price is far better than "shared hosting". I've used Rackspace's Mosso, but it sucked - it never felt like a normal .NET stack (caching was odd, site recompilation was odd)....

WCF - High availability

Is there anyway to configure a WCF service with a failover endpoint if the primary endpoint dies? Kind of like being able to specify a failover server in a SQL cluster... Specifically I am using the TCP/IP binding for speed, but on the rare occurrence that the machine is not available I would like to redirect traffic to the failover ser...

Can I configure Visual Studio NOT to change StartUp Project everytime I open a file from one of the projects?

Let's say that there is a solution that contains two projects (Project1 and Project2). Project1 is set as a StartUp Project (its name is displayed in a bold font). I double-click some file in Project2 to open it. The file opens, but something else happens too - Project2 gets set as a StartUp Project. I tried to find an option in config...

RhinoMocks: How do you properly mock an IEnumerable<T>?

I just keep stumbling through mocking... The latest disaster was not grokking that I need to actually push results inside a mock object of IEnumerable... Here's a sample (demonstration only of IEnumerable, not actually good Interaction-based testing!): using System; using System.Collections.Generic; using Rhino.Mocks; using MbUnit.Fra...