Category: CSharp

  • C# 11 Dates and Times

    It is a rare application that can be developed without in some way needing to work with dates and times. Recognizing this, the Microsoft engineers responsible for C# gave us the DateTime object. This chapter will look at using this object to work with dates and times in C# based applications. Topics covered include adding…

  • C# 11 String Formatting

    In addition to the wide selection of string manipulation functions outlined in the C# Strings lesson, the string class also provides the  String.Format() method. The primary purpose of the C#  String.Format() method is to provide a mechanism for inserting string, numerical, or boolean values into a string with additional formatting control. The Syntax of the String.Format() Method The general syntax of…

  • C# 11 String Examples

    Strings are collections of characters that are grouped together to form words or sentences. If it wasn’t for humans, computers would probably never have anything to do with strings. The fact is, however, that one of the primary jobs of a computer is to accept data from and present data to humans. For this reason,…

  • C# 11 Dictionary Collections

    C# dictionaries allow data to be stored and managed as key-value pairs. Dictionaries fulfill a similar purpose to arrays and lists, except each item stored in the dictionary has associated with it a unique key (to be precise, the key is unique to the particular dictionary object) which can be used to reference and access…

  • C# 11 List Collections

    In the previous chapters, we looked at C# Arrays. While useful for many tasks, arrays are starting to show their age in terms of functionality and flexibility. The C# Collection Classes provide more advanced mechanisms for gathering groups of objects. What are the C# Collection Classes The C# Collection classes are designed specifically for grouping…

  • Accessing and Sorting C# 11 Array Elements

    The previous chapter explained how to create 2-dimensional, 3-dimensional, and jagged arrays in C#. In this chapter, we will explore how to access, remove, and sort the elements of an array. Getting the number of dimensions of an array The number of dimensions of an array can be obtained via the Rank property of the array. For…

  • Creating 2D, 3D, and Jagged Arrays in C# 11

    Arrays are certainly not unique to C#. In fact, just about every other programming and scripting language preceding the introduction of C# provided support for arrays. An array allows a collection of values of the same type to be stored and accessed via a single variable. Each item is accessed in the array variable through…

  • C# 11 Structures

    Having covered C# classes in the preceding chapters, this lesson will introduce the use of structures in C#. Although at first glance structures and classes look similar, there are some important differences that need to be understood when deciding which to use. This chapter will outline how to declare and use structures, explore the differences…

  • C# 11 Interfaces

    In this chapter, we will explain what C# interfaces are, how to write your own, and how to make other classes comply with one. Understanding C# interfaces By default, there are no specific rules to which a C# class must conform as long as the class is syntactically correct. In some situations, however, a class…

  • C# 11 Abstract Classes

    In the preceding chapters, we have looked in detail at object-oriented programming in C# and also at the concept of class inheritance. In this lesson, we will look at the next area of object-oriented programming, the abstract class. What is a C# abstract class? In the examples we have looked at so far in this…