Posts tagged as c#


An Interesting Use of a C# Foreach Loop

I've seen many different ways of clearing the contents of controls in a Windows Form object, some of which can be quite elaborate. While it can be fun to come up with these convoluted schemes, there is an easier way. Here's what I do...

OOP and C#: Making a Sample Class

Understanding the principles of OOP (object-oriented programming) is very important for those who wish to become .NET programmers, since the .NET Framework is built on the premise that everything is an Object. Since C# was created specifically to implement the .NET Framework, it stands to reason that C# is a good language to demonstrate the development of an object from a logical construct to a piece of working code. The code we will develop here can also be modified to work in pretty much any language that supports OOP. So, get your pencils and notepads ready, kids. It's time to build an object!

C# Sample: RandomDataSet Class

This is a class I had to code for a project to demonstrate a handful of sort and search algorithms. It is a self-contained class that can be used to build a List of integers. You could easily modify this class to manipulate pretty much any Collection.

C# Sample: Timing Class

This timing class can be used to test the execution time of your C# algorithms. We used it to compare the time it took various sort and search functions to complete execution.

C# Hashing Utility

I've had a frequent need lately to create various hash-strings (implementing a Gravatar helper, for instance), and I thought some of you might find the utility class I created useful. It's self-contained (other than the obvious reliance on .NET assemblies) and includes an enumeration I created to make the hash-type more obvious to work with.

Implementing ASP.NET Membership with a Custom Provider

Perhaps one of the most ubiquitous means of user management in an ASP.NET application is the oft-maligned Membership library, but let's be honest; the default Membership tools are pretty terrible. If you use the default Membership, Roles, and Profile providers, you're going to have the awesome privilege of dealing with a database schema that revolves around serializing user information to BLOB fields.