Sunday, October 23

Characters Validation in Name field using C-sharp Language

The following program is to validate name field. There is a methods which is user defined named as checkEntry which is taking string as an argument. In this method a loop is used which is starting from 0 to string length. Code is pretty simple and anyone can understand it very easily. You will some useless variable and class in this code. You do not need to create another class and user defined method. This can be done in main method. Copy code from user defined method and paste it in main method and handle this in a loop as per requirement i have used 'while' loop here.

Saturday, October 22

Parsing the most commonly used technique in c-Sharp and Higher Level Languages

Parsing term actually refers to the coversion from one data type to another. In programming parsing technique is very important while concering with user data of different data types. You need to convert a string containing char digits into an integer, allowing you to use a numeric value. There are several methods, such as int.Parse, that are ideal for this. Here we look at three useful methods that are effective, assuming your code must only accept very simple input strings, using code in the C# programming language.

String input data:
"999" // input is integer
"-26" //input is signed integer
"abc" //string is the input value
"0.123" //input is of float type

Sunday, October 9

Composition Concept using C-sharp language source code

Composition is basically has a relationship and deals with the object creation in different classes. It is different from Inheritance. Object composition is a way to combine simple objects into more complex ones. Compositions are a critical building block of many basic data structures, including the tagged union, the linked list, and the binary tree, as well as the object used in object-oriented programming. Composited  objects are often referred to as having a "has a" relationship.

Friday, October 7

Exception Handling using C-Sharp Language

Exception occurs when user tries enters an invalid value like we have provided user with an application to enter an interger and he/she enters a string value as in input. If the exception is not handled at this point then your application will crash ultimately. Exceptions are unforeseen errors that happen in your programs. Most of the time, you can, and should, detect and handle program errors in your code. In lower level languages exceptions are not being handled. But if you move to the higher level language like c-Sharp, java. Microsoft provides special techniques to the developer so by using these methods properly you can protect your application from being crashed.

Age Calculator using User define Methods

Another example of Console application using c sharp language. lets find out how this program works. i have made different classes like validateMonth, validateDay  which does not need to be made. it works fine if you do not make these classes. you want to calculate your age(Years, Months, Days) you only need to enter date of birth and subtract date of birth from today's Date. you will be shown output very accurate but this application for those who will not commit a mistake while entering the data of birth. to make it generic it requires some validations that will not allow the user to enter incorrect date of birth.

Find Maximum Value using Reference-type C-sharp Language Code

The code below will allow a user to enter differnet values of float type and after that you will be shown a maximum value which is existing in array of float type. Method which is marked as maxValue is taking two arguments first is an array which has a predefined size and the next one is max value. array is of one dimensional. In maxValue method a loop structure is implemented which will start from the zero to the size of array - 1.