.net

Windows Forms application "design"

I'm planning on writing a "medium-size" WinForms application that I'll write in C#, .NET 3.5. I have some "generic design questions" in mind that I was hoping to get addressed here. Exception handling in general. What is the best way to handle exceptions? Use try/catch blocks everywhere? this? Localization. If I'd want to have multiple...

Extending the list of supported image formats in GDI+

To quote the documentation for the System.Drawing.Imaging namespace The Encoder class enables users to extend GDI+ to support any image format. Yet I can find no documentation, examples or anything else that explains how I'd go about implementing my own custom file format -- most searches return lots of information on passing Enco...

How to unregister my .net assembly when it's no longer in the same location?

I have a dll that's registered for com interop, so under HKLM\Software\Classes\CLSID[my guid]\InprocServer32[my version no]\Codebase it has the path of the registered dll. However, I've rearranged my folder structure so that path is no longer correct. Is there a way of unregistering that dll without putting it back, then unregistering, t...

What possibilities are there for post mortem analysis in .NET (e.g. after a crash of a program)?

Let's suppose there is a C# program, which is used as a windows service. Let's suppose that the service has gone wild and is consuming CPU and memory like mad. It needs to be restarted very soon, because it's a production system. So I don't have much time to gather run-time information. Maybe a quick look on the task manager ... that's a...

WPF designer won't load with entity framework

I have been having real problems getting the WPF designer to work in VS 2008 when i use the entity framework. I have a user control that gets data from an entity model. The user control designer loads fine but the main window throws the following error "Could not create an instance of type 'CampaignList". When i compile the project there...

Get Raw XML from java web service call in .NET

Hi, I am calling a Java web service using a .NET client, the return message is badly formatted since the deserialzation process throws an exception. Is there a way to view the raw xml data being returned by the web service in the .NET Client. Many thanks ...

Usage of MATLAB classes compiled to .NET

I compiled a MATLAB class to .NET, but instead of having my proper constuctor and methods in my class classdef Foo properties p1 p2 end methods function bar ... I have these functions in the .NET assembly: ~Algo() public Algo() public void Foo(int numArgsOut, ref MathWorks.MATLAB.NET.Arrays.MWArray[] argsOut, Mat...

What are some good sample desktop application projects I could do in C# .NET

What are some good desktop application projects I could code up that would be good practice? I have gone through the .NET Framework namespace structure pinpointing some of the namespaces and classes I have not used, so that I could come up with a project or two to create using them. However, I am having trouble thinking of projects t...

Opposite of String.Split with separators (.net)

Is there a way to do the opposite of String.Split in .Net? That is, to combine all the elements of an array with a given separator. Taking ["a", "b", "c"] and giving "a b c" (with a separator of " "). UPDATE: I found the answer myself. It is the String.Join method. ...

HttpWebRequest without a response - is it ok?

Hi all, I'd like to know if I can send an HttpWebRequest without waiting for a response (using .NET). I am interested in SENDING information, but I don't care about the response. Do I HAVE to wait for the response? Or I'm safe to just issue the request? I guess it's the same question as: http://stackoverflow.com/questions/449506/how...

.NET Nested Classes

The current class library I am working on will have a base class (Field) with over 50 specific "field" types which will inherit from "Field" and nested for maintain readability. For example... abstract class Field { public int Length { get; set; } public class FieldA : Field { public static void DoSomething() ...

sync online order portal with local DB

So we're building a locally(at customers site) hosted, custom point of sale system, nothing too much out of the ordinary. Its all .NET, C# and SQL Server. One of the requirements is that the system allows orders to be taken over the internet as well. For various reasons(connection reliability/speed, backups, stability, maintainance, et...

System.Diagnostics.Process.Start() cannot start process when called from Windows service.

I am trying to start an external process from a .NET Windows service. In the past I have used the Process.Start() overload that takes the executable path and a command line string. This works. But now I would like to start the process and have it run in the context of a particular user. So I call this version of Start() public static Pr...

Destructor vs IDisposable?

I've read about disposing objects/IDisposable interface and destructors in C#, but to me they seem to do the same thing? What is the difference between the two? Why would I use one over the other? In fact, in this example (link below) this code uses both the IDisposable interface and a destructor: http://msdn.microsoft.com/en-us/librar...

Debugging ASP.NET Session State server issues

We have an application that runs over load balanced server instances, and therefore is configured to use the ASP.NET session state service, which is running on one of our DB servers. While both instances of our app can successfully connect to the state server, changes in session state data are not being reflected across both of them. FI,...

Error 10048 when trying to open TcpChannel

Hello! I'm pretty inexperienced in Remoting. I'm trying to use it and keep receiving WinSock error 10048 when opening TcpChannel. I use the simplest code from MSDN: TcpChannel serverChannel = new TcpChannel(9090); ChannelServices.RegisterChannel(serverChannel); RemotingConfiguration.RegisterWellKnownServiceType( ty...

Is there a good, re-usable parser that converts a string into a hierarchy of lists?

I'd like to take a string such as this: [One, Two[A, B[i, ii, iii, iv], C], Three] And convert it into a hierarchy of lists, so that if I execute code such as the following: Console.Write(myList[1][1][2]); The output will be: iii I'm hoping that this is a common enough requirement that there's some simple parsing code written in...

Best practice: Override OnDispose(bool disposing) vs Disposed event on Component.

In .Net the Component class exposes a Disposed event. It also provides a protected member OnDispose(bool disposing). What is the best practice for a custom component that extends Component? Override OnDispose(bool) or attach an event handler to Disposed on construction? My feeling is that one should override OnDispose(bool) and sea...

Determining scope of a MemberExpressions target

Is there anyone here with experience writing custom Linq proviers? What I'm trying to do is tell whether a MemberExpression that is a property on a business object should be included in the sql, or treated as a constant, because its from a local variable that just happens to be a business object. So for example, if you have this: Cust...

In the Dispose(bool) method implementation, Shouldn't one set members to null?

None of the guides/notes/articles that discuss IDisposable pattern suggest that one should set the internal members to null in the Dispose(bool) method (especially if they are memory hogging beasts). I've come to realize the importance of it while debugging an internal benchmark tool. What used to happen was that, there was this buffer ...