Caller Information in C# 5

Caller Information is a new concept introduced in C# 5. It is aimed at providing useful information about where a function was called. It gives information such as:
  • Full path of the source file that contains the caller. This is the file path at compile time.
  • Line number in the source file at which the method is called.
  • Method or property name of the caller.

Reverse the Words in a Given String

This simple C# program reverses the words that reside in a string. The words are assumed to be separated by a single space character. The space character along with other consecutive letters forms a single word. Check the program below for details:



Matrix Transpose Code in C#

This program illustrates how to find the transpose of a given matrix. 

Check C# Progamming Code below for details.


Fibonacci Series Code in C#

Fibonacci series is a series of numbers where the next number is the sum of the previous two numbers behind it. It has the starting two numbers predefined as 0 & 1. The series goes on like this:
0,1,1,2,3,5,8,13,21,34,55,89,144,233,377……..

Here we illustrate two techniques for the creation of the Fibonacci Series to n terms. The For Loop method & the Recursive Technique. Check them below.

Obtain Local Host IP in C# 5

This program illustrates how we can obtain the IP address of Local Host. If a string parameter is supllied in the exe then the same is used as the local host name. If not then the local host name is retrieved and used. See the code below:

Monitor Turn On/Off/StandBy in C# 5

You might want to change your display settings in a running program. The code behind requires the Import of a Dll & execution of a function SendMessage(,,,) by supplying 4 parameters. The value of the fourth parameter having values 0, 1 & 2 has the monitor in the states ON, STAND BY & OFF respectively. The first parameter has the value of the valid window which has received the handle to change the monitor state. This must be an active window. You can see the simple code below:

Search Techniques: Linear & Binary

Searching is needed when we have a large array of some data or objects & need to find the position of a particular element. We may also need to check if an element exists in a list or not. While there are built in functions that offer these capabilities, they only work with predefined datatypes. Therefore there may the need for a custom function that searches elements & finds the position of elements. Below you will find two search techniques viz. Linear Search & Binary Search implemented in C#. The code is simple & easy to understand & can be modified as per need.


Working With C# Strings: Selection Property

This Program in C# 5 shows the use of the Selection property of the TextBox control. This property is accompanied with the Select() function which must be used to reflect changes you have set to the Selection properties. As you can see, the form also contains two TrackBars. These TrackBars actually visualize the Selection property attributes of the TextBox. There are two Selection properties mainly: Selection Start & Selection Length. These two properties are shown through the current value marked on the TrackBar.

Matrix Multiplication in C# 5


The Perfect Matrix Multiplication Tutorial Program in a C# 5.0 Console Application
  • Multiply any number of rows with any number of columns
  • Check for Matrices with invalid rows and Columns
  • Ask for entry of valid Matrix elements if value entered is invalid
  • All work done in .Net Framework 4.5
  • The code has a main class which consists of 3 functions logically structured
  • The first function reads valid elements in the Matrix Arrays
  • The second function multiplies matrices with the help of for loop
  • The third function simply displays the resultant Matrix
  • Check for the source code at the end.