Archive for the ‘c#’ Category
Sunday, June 3rd, 2007
In C# using .Net 2.0+, there is now built-in support for Generics collections using the System.Collections.Generic namespace. I use the List type most often, as a strongly-typed substitute for the ArrayList. Since it is strongly-typed, you now have design-time type-checking for enumerations like this (no casting necessary):
List<int> Foos = new ...
Posted in c#, Code | No Comments »
Sunday, April 15th, 2007
I am constantly needing to search my code to find the exact syntax for how to do this, so for future reference (for myself and anyone else who finds this useful), to declare and call an event from a custom user control or inherited control:
public class CustomEventArgs : EventArgs {
...
Posted in c#, Code | No Comments »
Thursday, April 12th, 2007
I was in need of a quick way to capitalize all of the words in a string (and though to check with Google before writing my own implementation). Here is what I found:
This one is built-in to .Net, but can be slow at times (and some people do not like ...
Posted in c#, Code | No Comments »
Tuesday, April 10th, 2007
I am right now in the middle of transferring a piece of functionality from one project (ASP.net 1.1 web application) to a second project (Windows Forms desktop application). Although it is a significant feature, most of the work should be straight copy-paste. It is a large chunk of code written ...
Posted in c#, Code | No Comments »
Monday, March 19th, 2007
In a WinForms project that I am working on right now, I have text stored in HTML format in the database. I need a way for novice users to be able to edit this text using a WYSIWYG interface.
The most obvious choice for this in the Windows.Forms control library that ...
Posted in Articles, c#, Code, windows forms | 5 Comments »
Friday, March 2nd, 2007
In my current project, I would like to log all Windows Forms errors, including those that are not caught explicitly. Lacking a built-in method (like Application_Error in the Global.asax file of an ASP.net application), I needed another way to easily catch all errors. After a bit of searching, I ...
Posted in Articles, c#, Code, windows forms | 1 Comment »