Short | UShort | Int16 | UInt16

Short is a data type in c# which is to carry numbers in the range -32,768 to 32,767. Short is value type variable. So when you pass an short to a variable or a method, system creates of a copy for that variable, this means when you change copied variable, it won’t affect the main variable. Or changing main variable won’t affect copied variable.

Read More
Value TypePredefined TypeData Types

Long | ULong | Int64 |UInt64

Long is a data type in c# which is to carry numbers in the range -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Long is value type variable. So when you pass an long to a variable or a method, system creates of a copy for that variable, this means when you change copied variable, it won’t affect the main […]

Read More
Value TypePredefined TypeData Types

Implicit Operator

Implicit operator provides developer to cast a type to another type implicitly. Let’s assume i have an object of Car class and want to cast it to MyCar class implicitly. Take a look at he following example to see how it works

Read More
General

Explicit Operator

Explicit operator provides developer to cast a type to another type explicitly. Let’s assume i have an object of Car class and want to cast it to MyCar class explicitly. Take a look at he following example to see how it works

Read More
General

What is Published Interface

Published interface is an interface which has a signed contract with clients. In simple terms, assume you have an interface, it becomes published interface when you ship it to development community. Here is an example about version upgrade of an published interface according to the article of Martin Fowler [here].   Published interface which is […]

Read More
Published InterfaceWhat is ?

Extension Method

Extension method allows developers to extend functionalities of existing classes. Static classes keep extension methods as being static methods. Developers can add new functionalities for exisiting classes by implementing extension methods for them. Let’s look at the following examples to see how extension methods work.   For example, i need a function that compares two […]

Read More
General

Comparing Objects

Here are a few examples about how to compare two objects by their properties. Equals method is not appropriate for comparing two objects with their properties unless it is overriden. Because Equals method compares objects by their hashcode and their type. So comparing object with their properties is another subject. Let’s continue with the following […]

Read More
General

List<T> | IndexOf

IndexOf method is one of the methods of System.Collections.Generic. IndexOf method returns the index of the first item that equals to given item. If there are no items which equals to given item, it returns -1. IndexOf method has its overload methods. In the following examples, we will take a look at how IndexOf method […]

Read More
Collection

List<T> | GetRange

GetRange method is one of the methods of System.Collections.Generic. GetRange method returns a range for the current list. GetRange takes two parameters which are index and count. GetRange method returns items as given count parameter by starting index as given index parameter. That is all. Let’s take a look at the following example for better understanding.

Read More
Collection

List<T> | Finding Last Index | FindLastIndex

FindLastIndex method returns the index of the last item that meets the given condition. FindLastIndex method is one of the methods of System.Collections.Generic. If there are no items that meets the given condition, it returns -1. FindLastIndex  method has its overload methods. Let’s look at the following examples to see the how FindLastIndex methods work […]

Read More
Collection