.net

Is there a standard way to return values from custom dialogs in Windows Forms?

So right now my project has a few custom dialogs that do things like prompt the user for his birthday, or whatever. Right now they're just doing things like setting a this.Birthday property once they get an answer (which is of type DateTime?, with the null indicating a "Cancel"). Then the caller inspects the Birthday property of the dial...

My very own customized Outlook 2007 inbox

I'm trying to add a main-view (like inbox, contacts, etc...) to my outlook 2007 using C#. anyone have a clue if this possible or a sample code for it? ...

Font-dependent control positioning

I'd like to use Segoe UI 9 pt on Vista, and Tahoma 8 pt on Windows XP/etc. (Actually, I'd settle for Segoe UI on both, but my users probably don't have it installed.) But, these being quite different, they really screw up the layout of my forms. So... is there a good way to deal with this? An example: I have a Label, with some blank spa...

How do you return the focus to the last used control after clicking a button in a winform app?

I'm working on a windows forms application (C#) where a user is entering data in a form. At any point while editing the data in the form the user can click one of the buttons on the form to perform certain actions. By default the focus goes to the clicked button so the user has to click back on to the control they want to edit in order...

What is the syntax for an inner join in linq to sql?

I'm writing a linq to sql statement & I'm just after the standard syntax for a normal inner join with an 'on' clause in C#. ie how do you represent this in LINQ to SQL?: select * from table1 inner join table2 on table1.field table2.field EDIT: Real query to get all contacts for a dealer: select DealerContact.* from Dealer inne...

What C# mocking framework to use?

I want to start using mock objects on my next C# project. After a quick google I've found there are many: NMock EasyMock.NET TypeMock Isolator Commercial / Paid Rhino Mocks Moq So my question is: what one is your favourite .NET mocking framework and why? ...

How do you implement caching in Linq to SQL?

We've just started using LINQ to SQL at work for our DAL & we haven't really come up with a standard for out caching model. Previously we had being using a base 'DAL' class that implemented a cache manager property that all our DAL classes inherited from, but now we don't have that. I'm wondering if anyone has come up with a 'standard'...

What is the best way to interpret Perfmon analysis into application specific observations/data?

Many of us have used Perfmon tool to do performance analysis. Especially with .Net counters, but there are so many variables going on in Perfmon, that it always becomes hard to interpret Perfmon results in to valuable feedback about my application. I want to use perfmon, (not a tool like Ants Profiler etc) but how do I accurately interpr...

How to Determine the Installed ASP.NET Version of Host from a Web Page

I have a site running in a Windows shared hosting environment. In their control panel for the shared hosting account I have it set to use ASP.NET version 3.0 but it doesn't say 3.5 SP1 specifically. How can I view the installed version running on the server where my website is hosted in an asp.net page? ...

Queue alternatives to MSMQ on Windows?

If you want to use a queuing product for durable messaging under Windows, running .NET 2.0 and above, which alternatives to MSMQ exist today? I know of ActiveMQ (http://activemq.apache.org/), and I've seen references to WSMQ (pointing to http://wsmq.net), but the site seems to be down. Are there any other alternatives? ...

Why does TreeNodeCollection not implenent IEnumerable<TreeNode>?

TreeNodeCollection, like some of the other control collections in System.Windows.Forms, implements IEnumerable. Is there any design reason behind this or is it just a hangover from the days before generics? ...

How do you prevent the IIS default site web.config file being inherited by virtual directories?

I have the following code in a web.config file of the default IIS site. <httpModules> <add type="MDL.BexWebControls.Charts.ChartStreamHandler,Charts" name="ChartStreamHandler"/> </httpModules> Then when I setup and browse to a virtual directory I get this error Could not load file or assembly 'Charts' or one of its dependencies. ...

Filter linq list on property value

I have a List<int> and a List<customObject>. The customObject class has an ID property. How can I get a List<customObject> containing only the objects where the ID property is in the List<int> using LINQ? Edit: I accepted Konrads answer because it is easier/more intuitive to read. ...

Roaming settings with LocalFileSettingsProvider

On my way through whipping up a Windows Forms application I thought it might have been a good idea to use the settings file to store miscellaneous application options (instead of the registry) and user parameters (window positions, column orderings, etc.). Out of the box, quick and simple, or so I thought. All works as per MSDN using th...

What's the use of value types in .Net?

The official guidelines suggest that there can be very few practical uses for these. Does anyone have examples of where they've put them to good use? ...

C# string concatenation and string interning

When performing string concatentation of an existing string in the intern pool, is a new string entered into the intern pool or is a reference returned to the existing string in the intern pool? According to this article, String.Concat and StringBuilder will insert new string instances into the intern pool? http://community.bartdesmet....

Issue in Oracle Sql Query

I am facing problem with an Oracle Query in a .net 2.0 based windows application. I am using "System.Data.OracleClient" to connect to oracle database. Name of database is "myDB". Below the the connection string I am using: *Data Source=(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP) (HOST = 172.16.0.24)(PORT = 1522)))(CONNECT_...

How can I improve my support of Novell networks when I don't have a Novell network?

I work for a .NET/MSSQL shop that has trouble supporting customers running Novell, partially because we don't have Novell (or the money for it) and partially because we have no one with Novell experience. This question could easily be expanded to "How can we improve our support of technology X when we don't have technology X?" Obviously,...

How do I read a disk directly with .Net?

Is is possible to read a disk directly with .Net? By directly I mean via the device bypassing the file system. I think I would go about this by opening the device some way "\Device\Ide\IdeDeviceP2T0L0-1" for example. If I can't open the device with a .NET api knowing which Win32 API to use would be helpful. ...

IronRuby performance?

While I know IronRuby isn't quite ready for the world to use it, I was wondering if anyone here tried it and tested how well it faired against the other Rubies out there in terms of raw performance? If so, what are the results, and how did you go about measuring the performance (which benchmarks etc)? Edit: The IronRuby team maintains ...