Tag Archives: classes

Make a class define and raise events in C#

This example uses a BankAccount class to manage a bank account (and to show how to define and raise events). If the program tries to remove more money from the account than its current balance, the BankAccount object raises an … Continue reading

Posted in classes, events | Tagged , , , , , , , , , , , , | 4 Comments

Convert an array of bytes into an integer and back in C#

The BitConverter class provides static methods that let you convert various data types to and from arrays of bytes. (I suppose it might have made more sense to call it the ByteConverter class.) You can use those methods to convert … Continue reading

Posted in classes | Tagged , , , , , , , , , | Leave a comment

Find class ancestors in C#

The example Find classes that implement an interface or that are descendants of a given class in C# shows how to find a list of classes that are descendants of a class or interface. This example uses similar code to … Continue reading

Posted in classes, inheritance, interfaces, reflection | Tagged , , , , , , , , , , , , , , , | Leave a comment

Find classes that implement an interface or that are descendants of a given class in C#

This example lets you find classes that are part of an inheritance or implementation hierarchy. When you enter a class or interface name and click Find, the example uses the following code to search the currently loaded assemblies for classes … Continue reading

Posted in classes, inheritance, interfaces, reflection | Tagged , , , , , , , , , , , , , , | 1 Comment

List a program’s loaded assemblies in C#

The key to this example is the following ListAssemblies method. // List the assemblies. private void ListAssemblies() { lblNumAssemblies.Text = “”; lstAssemblies.Items.Clear(); Cursor = Cursors.WaitCursor; Refresh(); foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) { lstAssemblies.Items.Add(assembly.GetName().Name); } // Display the number of assemblies. … Continue reading

Posted in classes, reflection | Tagged , , , , , , , , , , , , | Leave a comment

Book Errata Page: The C# Helper Top 100

This is the errata page for my book The C# Helper Top 100, The 100 most popular posts at csharphelper.com. If you find mistakes, please post them here in the Leave a Reply box at the bottom of the page. … Continue reading

Posted in .NET, algorithms, books, C#, C# programming | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | 2 Comments

Book Discussion Page: The C# Helper Top 100

This is a discussion page for my book The C# Helper Top 100, The 100 most popular posts at csharphelper.com. Please post questions, thoughts, and suggestions here in the “Leave a Reply” box at the bottom of the page. I … Continue reading

Posted in .NET, algorithms, books, C#, C# programming | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | 2 Comments

Table of Contents: The C# Helper Top 100

This is a brief summary of the book’s table of contents. Introduction Part I. Serialization 1. Read a CSV File into an Array (1) 2. Use JSON to Serialize and Deserialize Objects (49) Part II. Graphing 3. Draw a Graph … Continue reading

Posted in .NET, algorithms, books, C#, C# programming | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | 2 Comments

New Book: The C# Helper Top 100

I’m happy to announce my latest book, The C# Helper Top 100, The 100 most popular posts at csharphelper.com. It describes the 100 most popular posts on the C# Helper web site. This is my 32nd book and my second … Continue reading

Posted in .NET, algorithms, books, C#, C# programming | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Use Array methods in C#

The example Sort and search arrays in C# shows how to use two useful Array methods: Sort and BinarySearch. This example demonstrates some other useful Array methods. For simplicity, this example uses arrays of characters to demonstrate the Array methods, … Continue reading

Posted in arrays, classes | Tagged , , , , , , , , , , , , , | Leave a comment