.NET 2.0

How to Minimize an Application to the Taskbar Tray in C#


Posted in:

One very convenient features in windows is the Taskbar. To make it even better, those little icons can make something so "out of the way" that you can forget what is even down there. But, sometimes you want your applications to hang down there, out of the way, doing something that requires little attention. You can even make some notification bubbles show up if you want.

Read More Icon Read More

Combining Images with C#


Posted in:

Let's say you have two or more separate images and you'd like to combine those into a single image using C#. That's what this tutorial is going to demonstrate. We're going to create a function that takes multiple images and combines them into a large panoramic.

Read More Icon Read More

C# - Explicitly Implementing Interfaces


Posted in:

You have probably implemented interfaces hundreds of times in C#, and perhaps even created some of your own. But did you know that there are actually two different ways to implement an interface in C#? There is the common way - the way that almost everyone always uses, but then there is a second way, called "Explicit Implementation". And no, it has nothing to do with cursing or expletives (although, the first time I ran across it, there might have been a few of those). Explicit implementation is not used very often, but it is quite powerful - and like all powerful things, can get you into trouble from time to time if it isn't used carefully.

Read More Icon Read More

C# Tutorial - Poking at Event Contents


Posted in:

Events in C# always feel like there is a little touch of black magic in the background keeping things running smoothly. We have had tutorials here before on events in C# - we took a look at how to create your own custom events in C# Snippet Tutorial - Custom Event Handlers, and we looked at the syntactic sugar behind the += and -= operators for events in C# Tutorial - Event Accessors. But we have never taken a look at what actually happens when you declare an event, and what happens when you invoke it.

Read More Icon Read More

C# Tutorial - Using Reflection to Get Object Information


Posted in:

Every once in a while you might want to know what fields, properties, or events a certain type of object contains at runtime. A common use for this information is serialization. .NET contains lots of different serialization techniques, like binary and XML, but sometimes you just have to roll your own. This tutorial is going to demonstrate how to get a list of public fields, properties, and events from objects at runtime.

Read More Icon Read More

C# Snippet Tutorial - The ?? Operator


Posted in:

Just the other day I came across a C# operator that I found particularly useful and decided to share it with everyone here at SOTC - the ?? operator. The briefest explanation is this: ?? is used a lot like the conditional operator (?:), except instead of any condition, it will only check if the value on the left is null. If it is not null, it returns the item on the left - otherwise it will return the thing on the right.

Read More Icon Read More

C# Dialogs, Part 2 - Custom Dialogs


Posted in:

Ok, so in Part 1 we went over the MessageBox that C# offers. As simple and easy as it is to use MessageBox, sometimes you need something more customized to your needs. Although MessageBox is extremely simple to use, it is almost as easy to create your very own dialog and use whatever you want.

Read More Icon Read More

C# Tutorial - Object Finalizers


Posted in:

Recently, in a tutorial about Weak References in C#, we talked a bit about garbage collection and how the garbage collector works in .NET. I figured since we already started addressing that stuff, there is no reason not to delve deeper. And so, today we are going to take a look at how object finalizers work in C#.

Read More Icon Read More

C# Dialogs, Part 1 - MessageBox


Posted in:

We have all seen them, and most of the time they mark something bad. They are dialog boxes and not only have they been the bane of all computer users since the GUI was invented, but they are really a key to any software project. Whether you are making a simple text editor, or you programming a time viewing machine, chances are you at some point going to need a dialog box. Luckily, with C# adding one is super easy.

Read More Icon Read More

C# Tutorial - Weak References


Posted in:

We all know (hopefully) that C# is a garbage-collected language. In general, what this means is that we as programmers don't need to free our own memory - the garbage collector will free that memory for us once it is no longer being referenced. Now, of course, garbage collection is a lot more complicated than that, and writing a good garbage collector is actually a relatively hard problem. And the fact that writing a perfect garbage collector is probably impossible is the reason why things like C#'s Weak Reference object exist.

Read More Icon Read More

Sponsors