.net

Why does the memory usage of a .NET application seem to drop when it is minimized?

For example, launch Paint.NET. Then have a look on its memory usage with Task Manager: on my computer, it uses 36Mb. Then minimize Paint.NET: now it takes only a few more than 1Mb. This happens with every .NET Application. What happens when a .NET Application is minimized? Is a GC occurring? ...

Is there an easy way to animate the ScrollableControl.ScrollControlIntoView method?

I have a form where controls are dynamically added to a Panel. However, when they do so, they are many times added below the fold (bottom of the container). It's nice that the .NET Framework provides this ScrollControlIntoView method, however, for added usability, it would also be nice if there was an easy way to animate so that it is ...

System.Windows.Forms.WebBrowser open links in same window or new window with same session

When using the .NET WebBrowser control how do you open a link in a new window using the the same session (ie.. do not start a new ASP.NET session on the server), or how do you capture the new window event to open the URL in the same WebBrowser control? ...

Does List<>.IndexOf compare by reference or value?

List<tinyClass> ids = new List<tinyClass(); ids.Add(new tinyClass(1, 2)); bool b = ids.IndexOf(new tinyClass(1, 2)) >= 0; //true or false? If it compares by value, it should return true; if by reference, it will return false. If it compares by reference, and I make tinyClass a struct - will that make a difference? ...

Using app.config with Interop Controls

I have a .net project (MySolution.Common) that uses the app.config. I am using the project MySolution.Common in an InteropUserControl project called MySolution.InteropCtrl. MySolution.InteropCtrl is embedded into a VB6 project. When the MySolution.InteropCtrl is in the VB6 project, It cannot find the app.config file. Everything in the In...

Manage multiple app config files during development

I'm building an application that is used by several different customers. Each customer has a fair amount of custom business logic, which I have cleverly refactored out into an assembly that gets loaded at runtime. The name of that assembly, along with a number of other customer-specific settings, are stored in the application's configu...

Validate String against USPS State Abbreviations

I need to be able to validate a string against a list of the possible United States Postal Service state abbreviations, and Google is not offering me any direction. I know of the obvious solution: and that is to code a horridly huge if (or switch) statement to check and compare against all 50 states, but I am asking StackOverflow, sinc...

Every now and then, ABCpdf runs out of memory

The project I'm on is using a 3rd party component to build dynamic PDFs in a VB.Net web system called ABCpdf.Net. (not a terrible tool, but not a great one either.) Every now and then, for reasons I can't fathom, the document object throws a SEHException. Digging futher, it turns out this is caused by a custom exception in the documen...

Profile debug or release build?

I need to do some memory profiling of a .NET Framework application. Should I use a debug or a release build? ...

Creating a shared workspace with ASP.NET and Ajax

Here's a hypothetical situation I've been wondering about lately. Suppose I have an interactive page created in ASP.NET and Ajax that I want multiple users to be able to manipulate at the same time. What would be the best way to maintain this page's state? Especially if the page was relatively ephemeral, and did not particularly need ...

synchronized development environments

new to visual studio and programing in general. I am starting to work on a asp.net project. At home I have a computer running Windows 2008 Server with SQL 2008 and Visual 2008 running. I want to install the same thing on my laptop win2008/sql2008/vs2008 so I can take it with me on the go. What I want to know is how would I synchronized...

Unit Testing, Deadlocks, and Race Conditions

Any suggestions on how to write repeatable unit tests for code that may be susceptible to deadlocks and race conditions? Right now I'm leaning towards skipping unit tests and focusing on stress tests. The problem with that is you can run a stress test 5 times and see five different results. EDIT: I know its probably just a dream, but i...

Persisting configuration items in .net

I have a set of configuration items I need to persist to a "human readable" file. These items are in a hierarchy: Device 1 Name Channel 1 Name Size ... Channel N Name ... Device M Name Channel 1 Each of these item could be stored in a Dictionary with a string Key and a value. They could also be in a...

Irregular shaped Windows Form (C#)

Hi, What is the easiest way to do this? Is it possible with managed code? Thanks for your time. ...

What is the best way to build a common utilities library?

I am wondering what is the best way to construct a common utilities library that can be used in different projects. I am using .Net and C#. Should I create a separate project for each utility such as Logging, Authentication, Excel etc. and release them separately along with dependencies or should i include all utilities in one common ut...

Make DOM element effectively read-only

I'm writing a .NET forms control to edit HTML using MSHTML. I am creating some custom elements and want to make them effectively read-only. I thought I could go about this by focusing on the entire element any time focus entered anywhere in that element but the HtmlElement.Focus() doesn't select the entire element and I don't seem to b...

C#: Non-Winforms way to exit the application?

I know about Application.Exit() but what if I'm not in a windows forms application but in a simple class library, how do I signal for the application to exit? ...

Can someone give a good tutorial on WWF?

In particular, I am interested in: 1) Getting up a free environment setup to do workflows. 2) How to use existing workflow items/states and what is involved in that. Thanks! ...

Design Pattern for implementing plugins in your application?

What is the standard way for allowing and implementing a plugin system for your application? In my last application I made a simple interface for all plugins that they must implement. I then load all assemblies in the apps directory and toss out any that don't implement that interface. One of the methods in the interface is a DoWork()...

How do I get the list of open file handles by process in C#?

How do I get the list of open file handles by process id in C#? I'm interested in digging down and getting the file names as well. Looking for the programmatic equivalent of what process explorer does. Most likely this will require interop. Considering adding a bounty on this, the implementation is nasty complicated. ...