.net

Unit testing the app.config file with NUnit

When you guys are unit testing an application that relies on values from an app.config file? How do you test that those values are read in correctly and how your program reacts to incorrect values entered into a config file? It would be ridiculous to have to modify the config file for the NUnit app, but I can't read in the values from ...

what is the best way to do keep alive socket checking in .NET ?

I am looking for a way to do a keep alive check in .NET. The scenario is for both UDP and TCP. Currently in TCP what I do is that one side connects and when there is no data to send it sends a keep alive every X seconds. I want the other side to check for data, and if non was received in X seconds, to raise an event or so. One way i t...

Where to find like-minded FOSS developers?

I have started work on an open-source project and I'd like to find related projects and people that want to work on something similar. Is there a site for finding such people? The idea is a multi-syntax extensible .NET compiler framework, in case those people are here. ...

C# equivalent of sql server's IsNull() function

In sql server you can use the IsNull funtion to check if a value is null. I am wondering if there is anything similar in C#, rather than manually checking: For eg: myNewValue = IsNull(myValue, new MyValue()); instead of: if (myValue == null) myValue = new MyValue(); myNewValue = myValue; Thanks. ...

How do you get a System.Web.HttpWebRequest object to use SSL 2.0?

I don't know if I have all the information needed to phrase this question well, so bear with me. I have a local web page (local meaning 192.168.*) that is protected with a self-signed SSL cert. I'm trying to access this page using a System.Net.HttpWebRequest object, but I'm running into a weird problem. If this page is accessed in Inte...

Is the #region directive really useful in .NET?

After maintaining lots of code littered with #region (in both C# and VB.NET), it seems to me that this construct is just a bunch of "make work" for the programmer. It's work to PUT the dang things into the code, and then they make searching and reading code very annoying. What are the benefits? Why do coders go to the extra trouble to p...

Understanding dlls and how they work in Visual Studio

Does anyone have a good resource on dlls and how they are used / generated in Visual Studio? A few questions I'm rather hazy on specifically are: How refresh files work How dll version numbers are generated The difference between adding a reference by project vs browsing for the specific dll Any other tips are welcome as well. ...

Is there a Timer class in C# that isn't in the Windows.Forms namespace?

I want to use a timer in my simple .Net application written in C#. The only one I can find is the Windows.Forms.Timer class. I don't want to reference this namespace just for my console app. Is there a C# Timer (or Timer like) class for use in Console apps? ...

Why isn't my custom WCF behavior extension element type being found?

I have a solution that contains two projects. One project is an ASP.NET Web Application Project, and one is a class library. The web application has a project reference to the class library. Neither of these is strongly-named. In the class library, which I'll call "Framework," I have an endpoint behavior (an IEndpointBehavior implementa...

.NET Usercontrols telerik devexpress infragistics ComponentOne: who's best?

I am considering the purchase of some .NET user controls with interest in both WinForms and asp.net. I have trialed in the past devexpress when I needed a hierarchical data grid for a personal project which I was impressed with. Rather than just jump for them I am interested in peoples experience of different products such as: TelerikDev...

Improving code readability for SQL commands

In one of my classes for a web application I am developing, I have some reasonably long SQL queries. When developing a three-tier application, what are the best practices to make this kind of code neater? Dim dc As New SqlCommand("INSERT INTO Choices VALUES ('" + _ SanitizeInput(strUser) + "', '" + _ ...

C# & Win32 notify when separate window is closing / closed.

Is there a way to attach an event to a foreign / separate window from an .NET process that when the foreign window is closed or is about to close my application can be notified? I found this http://msdn.microsoft.com/en-us/library/ms229658.aspx But that seems to only be for the .NET compact framework. I am looking for something using t...

How to efficiently filter a large LIstViewItemCollection?

So I have a ListView with an upper limit of about 1000 items. I need to be able to filter these items using a textbox's TextChanged event. I have some code that works well for a smaller number of items (~400), but when I need to re-display a full list of all 1000 items, it takes about 4 seconds. I am not creating new ListViewItems eve...

DateTime, DateTime? and LINQ

When I retrieve a record using LINQ that has a DateTime field only the ToString() is available. Where are all the other DateTime methods? I have to Convert.ToDateTime the DateTime? that the Field returns? What is the difference between (DateTime) and (DateTime?) ...

Persisting Printer Settings

What is the best way to persist/save printer settings in .Net? There used to be a bug in .Net 1.1 in the serialization of the PrinterSetting object and there were some workarounds but I'm wondering if there isn't a better or easier way of doing this in the more recent versions of the framework. The main use case is to allow a user to de...

What's the best word processing component for .NET

I'm looking for a word processing component for .NET that would act like an embedded MS Word in my WinForm/WPF .NET app. The main goal being for users to be able to create rich formatted text. I don't really want to have to write a highly custom RichTextBox component. Any suggestions? ...

Best .NET comm component or protocol for very low bandwidth communication?

What's the best .NET communication component or protocol for very low bandwidth and intermittently connected communication (i.e.: < 10 kilobits/sec)? ...

INotifyPropertyChanging and validations: when do I raise PropertyChanging?

INotifyPropertyChanged is fairly self explanatory and I think I'm clear on when to raise that one (i.e. when I've finished updating the values). If I implement INotifyPropertyChanging I'm tending to raise the event as soon as I enter the setter or other method that changes the objects state and then continue with any guards and validatio...

Can I listen on a port (using HttpListener or other .NET code) on Vista without requiring administrator priveleges?

I'm using HttpListener to allow a user to set up a proxy on a user-defined port. When I start the HttpListener, I get an exception if the application isn't running under administrator privileges in Vista. From what I've read, this is expected behavior - administrator privileges are required to start listening on a port. But I'm sure the...

View MS Access Report in .net ReportViewer control

Is it possible to view an MS Access report in the .Net ReportViewer control? ...