.net

Linq to Sql - Hierarchical Query to Find Ancestors

Given an EmployeeId, how can I construct a Linq to Sql query to find all of the ancestors of the employee? Each EmployeeId has an associated SupervisorId (see below). Entity Definition: Sample Table Data: For example, a query of the ancestors for EmployeeId 6 (Frank Black) should return Jane Doe, Bob Smith, Joe Bloggs, and Head H...

How to unit test if my object is really serializable?

I am using C# 2.0 with Nunit Test. I have some object that needs to be serialized. These objects are quite complex (inheritance at different levels and contains a lot of objects, events and delegates). How can I create a Unit Test to be sure that my object is safely serializable? ...

Connection Strings modification after the deployment

Hi, I created the setup project for the application and I can see that the later modifications of the configuration file (Application.exe.config) don't affect the application execution. I am developing an application with the database file included and I want to enable users to move the database file and modify connection strings. Doe...

eliminate the enter key after pressing it in the keyup event of a textbox.

How to cancel a keypress event in a textbox after pressing the return key. ...

Confirmed features of .NET 4.0?

Does anyone know what will be in .NET 4.0? I found tuples on codeplex: .... // NOTE : this is a TEMPORARY and a very minimalistic implementation of Tuple'2, // as defined in http://devdiv/sites/docs/NetFX4/CLR/Specs/Base Class Libraries/Tuple Spec.docx // We will remove this after we move to v4 and Tuple is actually in there public st...

How do I redistribute Windows Imaging Component with .NET Framework 2.0?

I have a .NET Framework 2.0 app and would like to use the Windows Imaging Component. Since my application is a WinForms app and will be redistributed to users via an MSI installer I'm trying to figure out the best way to do this. I see a couple of options: 1) Skip .NET 2.0 and build on .NET 3.0 which includes the Windows Imaging Compone...

How to determine if radioButton.Checked is set programatically or via a mouse click?

I have a radio button on my Windows Form. How can I determine if the CheckChanged event occurred due to a user clicking or selecting the radio button vs programatically setting the event with this.radioButtonAdd.Checked = true; I would like some code to take a different action depending on if the user clicked the button or I raised t...

DRYing up object instantiation in C#

This code: public class WidgetPlatform { public Widget LeftmostWidget { get; set; } public Widget RightmostWidget { get; set; } public String GetWidgetNames() { return LeftmostWidget.Name + " " + RightmostWidget.Name; } } doesn't contain any repetition worth worrying about, but it isn't particularly robust...

Where are Outlook's mail accounts settings stored and how to read them?

If Outlook is installed on a PC, I need to read mail account settings using .NET but without using the Outlook object model. ...

.NET Microframework SDK with VS 2008

I am trying to get started developing using the .NET Micro Framework but appear to have hit a road block. I am using Visual Studio 2008 and it will not let me install the SDK because I do not have Visual Studio 2005. I downloaded the SDK from this link. I know this is not truly a programming question but it is definitely holding me bac...

.net/exchange: add email addresses dynamically?

I'm building a .NET application where I want to dynamically add an email address for users when they create an account, so that they can email themselves things to their account and see it in the app. The email address would be something like [account_name]@[site.com]. Is there a good reference URL to read which explains how to do this...

What's your favorite feature in .NET?

There are lots of features in .NET. Some language related, others will be related to the framework itself and having the ability to access/do/perform xyz. So for fun, I was wondering what the community's favorite features in .NET or ASP.NET include? This is a community wiki question as its mainly for polling purposes to see what kind of...

Delphi to .NET + C#

Hi, I've been a Delphi (D7) developer for many sometime already, I've always been wondering about the .NET + C# stuffs. What I mean are about not the "Delphi for .NET" or "Oxygene" tech/plugin, but clean .NET/C#. How much different is it from Delphi? And some other questions... Is Mono/SharpDevelop (any others that I should know of?)...

How in .Net do I Import Values from a CSV in the format I want using OleDB?

I have a CSV file that has a column that contains strings that look like integers. That is they should be dealt with as strings, but since they are numbers they appear to be imported as integers (dropping off the leading zeroes). Example Data: 0000000000079 0000999000012 0001002000005 0004100000007 The problem I'm seeing is that t...

WCF Bindings - so many! How do I choose one?

We have an R Server (R is a programming language used in statistical analysis) that basically takes a script and a csv file, processes some data and returns results as text. I need to write a service on the R server so that .net clients (could be .Net Windows Forms, or ASP.Net) can connect to the R server, submit the script and CSV fil...

.NET SslStream doesn't close TSL connection properly.

It doesn't send close_notify alert before closing the connection. How can I send close_notify alert? ...

Communication between server and client for WinForms

I have 50+ kiosk style computers that I want to be able to get a status update, from a single computer, on demand as opposed to an interval. These computers are on a LAN in respect to the computer requesting the status. I researched WCF however it looks like I'll need IIS installed and I would rather not install IIS on 50+ Windows XP bo...

Differences between .NET versions (predominantly c#)

Ive recently been asked to recommend a .NET framework version to use in a (GUI based) project for an XP machine. Can anyone explain the differences between all the .NET versions? OR, Does anyone have a good reference to a site that details (briefly) the differences? ...

Replace Line Breaks in a String C#

How can I replace Line Breaks within a string in C#? ...

Define an interface method that takes different parameters

My application uses measurement instruments that are connected to the PC. I want to make it possible to use similar instruments from different vendors. So I defined an interface: interface IMeasurementInterface { void Initialize(); void Close(); } So far so good. Before a measurement I need to setup the inst...