.net

.Net 2.0 - How efficient are Generic Lists?

I'm creating an app that holds loads of loads of user data in memory, and it's mostly keeping it all in List<T> structures (and some Dictionary<T,T> when I need lookup). And I'm wondering... How efficient are Lists? How much memory overhead do I get for each of them? (that is, memory space in addition to what the objects they contain w...

How can you make a .net windows forms project look fresh?

I'm working on a visual studio 2005 vb.net windows forms project that's been around for several years. It's full of default textboxes, labels, dropdowns, datagrids, datetime pickers -- all the standard stuff. The end result is a very gray, old-looking project. What would be the best approach to making this project look fresh and snazz...

.net multilingual cms

i am planning a simple, dual-language website and i'd like to use a .net based cms but i can't find anything suitable. i have experience with dotnetnuke and sharepoint but neither fit the bill - dotnetnuke does not do dynamic site elements multi-lingually & sharepoint is a monster PITA no matter what angle you look at it :). i am on th...

Convert Web.config from .NET 2.0 to 3.5

What is the minimum I need to add to a .NET 2.0 WebSite's web.config to make it .NET 3.5? Visual Studio adds all the config sections and script handlers, but if you aren't using those are they are really necessary? Is there a command line tool to "upgrade" a .NET 2.0 web.config to 3.5? ...

What Code Snippet Editor Do You Use?

Part of my "sort your development life out, Rob" push has been me taking note of the fact that I do not have a library of code snippets (and Jeff did a post too). Now I have a few, but I know I should really be working towards creating my own library to boost my productivity. One thing I have started doing is leaving my code snippet ed...

Reading text files using .NET

I need to read from a variety of different text files (I've some delimited files and some fixed width files). I've considered parsing the files line by line (slow using the File.ReadLine type methods) and reading the file using the ODBC text driver (faster) but does anyone have any other (better) suggestions? I'm using .NET/C#. ...

C#.Net: Why is my Process.Start() hanging?

I'm trying to run a batch file, as another user, from my web app. For some reason, the batch file hangs! I can see "cmd.exe" running in the task manager, but it just sits there forever, unable to be killed, and the batch file is not running. Here's my code: SecureString password = new SecureString(); foreach (char c in "mypasswo...

ASP.NET MVC on IIS6

Where can I find some good pointers on best practices for running ASP.NET MVC on IIS6? I haven't seen any realistic options for web-hosts who provide IIS7-hosting yet. Mostly because I don't live in the U.S. So I was wondering on how you best build applications in ASP.NET MVC and make it easily available to deploy on both IIS6 and IIS7...

Has .NET made raw COM and DCOM programming redundant ?

Has the introduction of the .net framework made raw programming in COM and DCOM redundant ? (Except for using some COM+ services, e.g. for transaction management through the System.EnterpriseServices namespace) ...

How do I truncate a string while converting to bytes in C#?

I would like to put a string into a byte array, but the string may be too big to fit. In the case where it's too large, I would like to put as much of the string as possible into the array. Is there an efficient way to find out how many characters will fit? ...

Send email from Elmah?

Is anyone using Elmah to send exceptions via email? I've got Elmah logging set up via SQL Server, and can view the errors page via the Elmah.axd page, but I am unable to get the email component working. The idea here is to get the email notification so we can react more quickly to exceptions. Here is my web.config (unnecessary sectionss ...

Is Object.GetHashCode() unique to a reference or a value?

The MSDN documentation on Object.GetHashCode() describes 3 contradicting rules for how the method should work. If two objects of the same type represent the same value, the hash function must return the same constant value for either object. For the best performance, a hash function must generate a random distribution for all input. ...

DesignMode with Controls

Has anyone found a useful solution to the DesignMode problem when developing controls? The issue is that if you nest controls then DesignMode only works for the first level. The second and lower levels DesignMode will always return FALSE. The standard hack has been to look at the name of the process that is running and if it is "DevEn...

Best Way to Reuse Code When Using Visual Studio?

I've tried 2 different methods of reusing code. I have a solution full of just class library projects with generic code that I reuse in almost every project I work on. When I get to work on a new project, I will reuse code from this code library in one of 2 ways. I have tried bringing the projects I need from this code library into my pr...

What is the best way to tell if an object is modified?

I have an object that is mapped to a cookie as a serialized base-64 string. I only want to write out a new cookie if there are changes made to the object stored in the cookie on server-side. What I want to do is get a hash code when the object is pulled from the cookie/initialized and compare the original hash code to the hash code that...

NHibernate Session.Flush() Sending Update Queries When No Update Has Occurred

I have an NHibernate session. In this session, I am performing exactly 1 operation, which is to run this code to get a list: public IList<Customer> GetCustomerByFirstName(string customerFirstName) { return _session.CreateCriteria(typeof(Customer)) .Add(new NHibernate.Expression.EqExpression("FirstName", customerFirstName)) .List...

Tools for finding memory corruption in managed c++ code?

I have a .NET application, which is using an open source C++ compression library for compressing images. We are accessing the C++ library via managed C++. I'm seeing heap corruption during compression. A call to _CrtIsValidHeapPointer is finding an error on a call to free() when cleaning up after compression. My question is, are th...

Does C# have a way of giving me an immutable Dictionary?

Is there anything built into the core C# libraries that can give me an immutable Dictionary? Something along the lines of Java's: Collections.unmodifiableMap(myMap); And just to clarify, I am not looking to stop the keys / values themselves from being changed, just the structure of the Dictionary. I want something that fails fast ...

How to expose a collection property?

Every time I create an object that has a collection property I go back and forth on the best way to do it? public property with a getter that returns a reference to private variable explicit get_ObjList and set_ObjList methods that return and create new or cloned objects every time explicit get_ObjList that returns an IEnumerator and a...

Register Multiple Assemblies to the GAC in Vista

I've got a whole directory of dll's I need to register to the GAC. I'd like to avoid registering each file explicitly- but it appears that gacutil has no "register directory" option. Anyone have a fast/simple solution? ...