Separating Design and Functionality
When we create a new windows form, a class that inherits from ;is generated. This class is separated in two files thanks to the feature called partial classes. Partial classes allow…
C# Event Handling
Graphical user interfaces in .NET and Visual C# uses event handling mechanism to handle events that occur while the program is running. Events are behaviors or happenings that occur when…
Creating a Simple Windows Forms
You will now experience visual programming which is the “Visual” in Visual C#. Please note that this lesson guides you to the creation of a simple windows application which uses…
C# Visual Programming
Graphical User Interfaces (GUI) allow a user to interact easily with the program using different visual components. On the early days of the computer world, applications are text based and…
Expression-Bodied Members
Expression-bodied members is a feature introduced in C# 6 that allows you to use lambda-like syntax to simplify writing of methods, properties, operator overloads, and indexers of a class. Instead of…
Lambda Expressions
Lambda expressions simplify the syntax of anonymous methods. For example, the program below used an anonymous method that will be assigned to a delegate. using System; namespace AnonymousMethod { public delegate void…
Extension Methods
Extension methods are methods that add functionality to .NET types or types that you have defined. For example, you can extend the ;class by adding a Reverse method that reverses the string. The following program…
Null Conditional Operator
The Null Conditional Operator is used for easier checking of null values for every member in object property path. We use the ?operator after a member or a method call then followed by…
Anonymous Types
You can define anonymous types which is a great way to define temporary types used for data storage types. Suppose that you just want a class that can hold three values inside…
Type Inference
Type inference allows a variable to infer the type being assigned to it. No more should a variable be strongly typed. C# offers the varkeyword for type inference. var myInt = 10;…