This section covers C# programming examples on Functions. Every example
program includes the description of the program, C# code as well as output of the program. All examples are compiled and tested on a Visual Studio. These examples can be simple C# programs or advanced C# programs. So, they are suitable for any user (dummies, beginners or advanced users).
Here is the listing of C# programming examples on Functions.
1. C# Examples on Predefined Functions
A group of statements which is used to perform a specific task is called a
function. The built-in functions which perform standard operations are called pre-defined functions. The following C# Programs reverses and sorts a string using various predefined functions and the other programs use the concept of recursion to display the binary form of an integer and for calculating the sum of all the digits in a number. C# Program to Reverse a String with Predefined Function C# Program to Sort a String using Predefined Function C# Program to Demonstrate Boxing Operations C# Program to Find Sum of Digits of a Number using Recursion C# Program to Demonstrate the Operations of C# Path Class C# Program to Print Binary Equivalent of an Integer using Recursion 2. C# Examples on Classes and their Abstract Properties
A class is a blueprint from which individual objects are extracted. Abstract
property does not contain any implementation of property accessors, it only includes the declaration that the class supports properties. iCollection count returns the number of elements in the collection. The following C# Programs demonstrates the properties of normal class and abstract classes, iCollection property and multiplication of numbers using recursion. C# Program to find Product of 2 Numbers using Recursion C# Program to Produce a filtered sequence of elements that contain only one
property of each Student
C# Program to Demonstrate Properties of the Class C# Program to Demonstrate Abstract Properties C# Program to Demonstrate Environment Type C# Program to Demonstrate the icollection Count C# Program to Demonstrate iscollection.synchronised 3. C# Examples on Method Types and Method Hiding
Method hiding is a phenomenon in which a subclass has defined a class
method with the same signature as a class method in the superclass. In that case the superclass method is hidden by the subclass. Goto statement is used for modifying the normal sequence of program execution by transferring control to some other part of the program. Static method can be invoked without creating an instance of a class. The method without any name is called anonymous method. The Obsolete attribute marks a program entity as one that is no longer recommended for use. The CultureInfo class contains culture-specific information, such as the associated language, sub-language, country/region, calendar, and cultural conventions. The following C# programs demonstrate the various properties mentioned above. C# Program Illustrate Method Hiding C# Program to Illustrate the Concept of Goto C# Program to Create Anonymous Method C# Program to Implement Static Method C# Program to Demonstrate Culture Names C# Program to Create Obsolete Class C# Program to Illustrate the use of Conditional Logical Operator 4. C# Examples on Namespaces and Preprocessor Attributes
Nullable data type assigns null values to data types. #define preprocessor substitutes a preprocessor macro. A namespace is a collection of pages which have content with a similar purpose. The following C# Programs demonstrate
pass by value, pass by reference, namespaces, preprocessors new modifier
and various nullable data types. C# Program to Demonstrate Pass by Value Parameter C# Program to Print Hello World Without using WriteLine C# Program to Demonstrate Pass by Reference Parameter C# Program to Implement Namespaces C# Program to Demonstrate the Working #define Preprocessor C# Program to Illustrate Regular Expression Pattern C# Program to Ilustrate Nullable Data Types C# Program to Demonstrate New modifier