.net

What's the best way to detect an internet connection using .NET?

I have a Windows Forms application. When the user imports a license for my application I'd like to "phone home" (hit an aspx page on the web) and register the license information. The problem is that the user may not have an internet connection working at that moment. I'd like to test this first. What's the best way to detect if the use...

Creating a version-independent outlook-addin

When using the add-in wizard for outlook add-ins in Visual Studio 2008, I have the choice between creating a add for Outlook 2003 and Outlook 2007 (both using .NET). However, if I chose one of these, the add-in doesn't run in the other version. What's the best way to create a add-in which runs in both versions? ...

Why readonly and volatile modifiers are mutually exclusive?

I have a reference-type variable that is readonly, because the reference never change, only its properties. When I tried to add the volatile modifier to it the compiled warned me that it wouldn't let both modifiers apply to the same variable. But I think I need it to be volatile because I don't want to have caching problems when reading ...

Should parameters/returns of collections be IEnumerable<T> or T[]?

As I've been incorporating the Linq mindset, I have been more and more inclined to pass around collections via the IEnumerable<T> generic type which seems to form the basis of most Linq operations. However I wonder, with the late evaluation of the IEnumerable<T> generic type if that is a good idea. Does it make more sense to use the T[...

IBM.Data.DB2

Can I develop a windows application using .NET framework and IBM.Data.DB2 provider to access a DB2 database running on OS/390? Thanks in advance. ...

LINQ- Combine Multiple List<T> and order by a value (.Net 3.5)

Hi, all I'm trying to combine a number of List<T> where T:IGetTime (i.e T will always have method getTime()). Then I'm trying order the items by the DateTime that getTime() returns. My LINQ looks like this: public static List<T> Combine(List<T> one, List<T> two, List<T> three) { var result = from IGetTime item in one ...

.NET / COM events interoperability

I have an interop assembly generated by TlbImp.exe, the generated classes are heavily evented and the performance is very important. But there's a problem, the events seem to be registered/unregistered/invoked in such a manner that even empty event handlers are counted in. Given a set of 1..N events, when you register a handler to an ev...

Using 32-bit COM object from C# or VBS on Vista 64-bit and getting error 80004005

I need some mind reading here, since I am trying to do what I do not completely understand. There is a 32-bit application (electronic trading application called CQG) which provides a COM API for external access. I have sample programs and scripts which access this API from Excel, .NET (C++, VB and C#) and shell VBScript. I have these ...

A better/good way to generate 4x4x4 Sudoku board?

For fun when I have time, I like to code games to see how hard it is or just because I want to see how it works from the inside or just for personal challenge. I just like coding. For now, I made these ones. So I made a Sudoku board. First it was the normal 3x3x3 board but then someone asked me to do a 4x4x4 board. I was successful but ...

.Net XmlSerializer: deserialize CDATA being inner text

Hello, I have a problem with CDATA deserialization using standard .Net XmlSerializer. Update: I get XML from external system and I can't influence it's format so I can't make CData be enclosed in a separate Element of Attribute. Serialization gives this: <?xml version="1.0" encoding="utf-16"?> <MyClass xmlns:xsi="http://www.w3.org/20...

WinForms Load vs. Shown events

Hopefully I'm just missing something obvious, but I'm trying to get my head around the differences between the Load and the Shown events in WinForms. Traditionally I've only used Load (or actually OnLoad, since I think it's cleaner to override a method than to rely on the designer to hook up an event on yourself), since that is availabl...

How to Display Vector Graphics (SVG) in a Winforms Application?

Does anyone know of a way (preferably a control) to display vector graphics (preferably SVG) in a Winforms app? Im guessing that this would be easy to do with WPF, but I would prefer not to have to migrate the project. ...

.NET Strings vs. Streams - Memory Profile and Characteristics

I need to pull large Unicode textual strings (e.g. 200Mb) from a Database (nvarchar) and store in memory for processing. i.e. I need random access to all parts of the strings. Looking at this from strictly memory centric point of view, what are the pro’s and con’s of using a System.IO.MemoryStream versus a System.String as my in memory ...

In-Process WMI Provider for a Windows Service in .NET

How do you write an in-process WMI provider as part of Windows Service written in .NET? I've written a provider that uses the de-coupled hosting model as a standalone application, but can't figure out how to get a Windows Service that uses the Hosting Model = ManagementHostingModel.NetworkService to work. This is the kind of provider I...

How to unit test winforms applications

Thanks to ASP.NET MVC framework, it became possible to unit test web applications. But how do you unit test windows forms applications? ...

Should I support Linux for a .NET application?

I've seen this blog post : Why you should support Linux and Mac? and it kind of changed my mind about the subject. I'm developing an application (something like a SEO tool, to analyse a website and recommend stuff) in VB.NET. Theoretically I can support Linux and Mac users with Mono. Does it really worth it? And how painful is it to ...

How can I run GUI application without login window session?

My goal is logout current session, then delete the running local user profile. And I have a service to delete the profile already. My problem is, the user has no idea about the background service and who may power off the machine or login again too soon. The idea is that the service will show some popup, and it will not display "Welco...

Reference project "readonly" in Visual Studio?

I have two applications in two solutions in VS2008 that share a common dll, the dll-code is included as a project in the first applications solution. Is it possible to allow the second solution to reference the dll project "readonly"? I want whoever opens the second solution to be able to step into the dll during debugging but not be a...

Adding an invisible image watermark in C#?

I want to insert multiple invisible watermarks into my JPEG pictures through C# code. That means that I need a .NET library that does this work and not some external batch application. Any suggestions? ...

How to debug "Unexpected debug information initialization error -- 'Failed to find a required export in the runtime.'"

I'm getting this error message on all projects (including brand new empty templates) I'm trying to build with Visual Studio 2008: Unexpected debug information initialization error -- 'Failed to find a required export in the runtime.' The Error Help for Compiler Error CS0040 is not very helpful: This error can occur when u...