Basics of C#

Primitive Data Types in C#

The built-in data type in C# is called primitive data types. Here we are giving you the range of most commonly used primitive data types in C#.   Data Type Description Size (bits) Range int Whole numbers 32 <->‡231 through 231 <-> 1 long Whole numbers 64 <-> §263 through 263 <-> 1 Float Floating-point …

Primitive Data Types in C# Read More »

The Value Type In C#

Creating Fields and Using Initializers The first type of class member we’ll take a look at is the field, also called a data member.Outside any method, A field is just a class-level variable, outside any method. If you create your field public, it’s accessible using an object of your class; for example, take a look …

The Value Type In C# Read More »

Operators & Variables In C#

C# has a number of standard operators, taken from C, C++ and Java. Most of these should be quite familiar to programmers; the less common ones are enclosed elsewhere.   Standard operators list are given below. Note that when we are writing any classes classes it is possible to change the default behaviors of some …

Operators & Variables In C# Read More »

Type Conversions in c#

Type conversion is a process of converting one type into another. Using C# type conversion techniques, not only you can convert data types, you can convert object types also. The type conversion in C# can be either implicit conversion or an explicit conversion.   If one type of data is automatically converted into another type …

Type Conversions in c# Read More »

Enums In C#

“The great power comes with a great responsibility.”   Enums are basically a set of named constants. They are declared in C# using the keyword enum. Every enum type automatically derives from System.Enum namespace and thus we can use System.Enum methods on our Enums.   Enums are value types and are created on the stack …

Enums In C# Read More »

Type-Safety in C#

At the first, what is type safe code and why is it relevant to secure programming? Type safety is certainly one of the most confusing aspects for somebody learning .Net. When .Net was released, it had a tag attached claiming that the programs developed in .Net are more stable when compared to programs developed using …

Type-Safety in C# Read More »

Scope of the Variable in C#

The scope of a variable is simply the region of the program in which that variable is usable. Scope applies to methods as well as variables. The scope of an identifier (of a variable or method) is linked to the location of the declaration that introduces the identifier into the program.   Local Scope   …

Scope of the Variable in C# Read More »

Control Statement in C#

C# uses two types of control statements: ? Conditional Statements ? Looping   Conditional Statements   In C#, there are two types of conditional statements: ? if statements ? switch statements   if statements   The first conditional statement is programmer’s favorite “if” statement. It has three forms:   1. Single selection 2. if-then-else selection …

Control Statement in C# Read More »

Scroll to Top