Sitemap
y sirisha

y sirisha

C#

6 min readOct 22, 2022

--

C Sharp: It is an object-oriented programming language provided by Microsoft that runs on .Net Framework.

C# Features

Datatypes: Few data types in c#

Press enter or click to view image in full size

Accept input at runtime:

Functions:

Math

String

Escaped Sequence: An escape sequence is represented by a backslash ( \ ), followed by a specific character that has special meaning to the compiler. For example, “ ” represents a newline in a double-quoted string.

Type conversions:

Classes:

1)Classes are reference types that hold the object created dynamically in a heap.

2)All classes have a base type of System.Object.

3)The default access modifier of a class is Internal.

4)The default access modifier of methods and variables is Private.

5)Directly inside the namespaces declarations of private classes are not allowed.

Methods: Methods are used to perform certain actions, and they are also known as functions.

Why use methods? To reuse code: define the code once, and use it many times. A method is defined with the name of the method, followed by parentheses ().

In Methods there are two types: static and instance method.

Press enter or click to view image in full size

Relational and logical operators:

There are different relational operators =, <, >, .The logical operators are &&, || etc.

Control Statements:

Strings:

Verbatim strings : Verbatim is a special kind of escape sequence which is used to print the slash in the sentence. Like if we want to print a link then we have to use a slash at that time this string is used.

Get y sirisha’s stories in your inbox

Join Medium for free to get updates from this writer.

String builder: Creating a StringBuilder Object You can create an object of the StringBuilder class using the new keyword and passing an initial string.

Enumeration: Enumeration (or enum) is a value data type in C#. It is mainly used to assign the names or string values to integral constants, that make a program easy to read and maintain.

Arrays: In C#, array is an object of base type System. Array. In C#, array index starts from 0. We can store only fixed set of elements in C# array.

Press enter or click to view image in full size

Jagged array

2D-Array

Out keywords: The out parameters can be used to remove the possibility of the return null value.

Param Array: Params array in C# is the way to create such type of method that can receive n numbers of parameters at runtime. It simplifies the program and makes C# programming more efficient.

Pass by value: Pass a copy of the original value to the function rather than reference. It does not modify the original value.

Press enter or click to view image in full size

Pass by reference: The ref keyword specifies that a value is passed by reference to a function. With this approach, there will only exist one copy of the variable in the memory, and a separate pointer will be passed to the function that points to the value of the variable.

Press enter or click to view image in full size

Pass by value reference

Press enter or click to view image in full size

Regular Expression

Press enter or click to view image in full size

Access Specifiers:

  1. Public: It specifies that access is not restricted.
  2. Protected: It specifies that access is limited to the containing class or in derived class.
  3. Internal: It specifies that access is limited to the current assembly.
  4. protected internal: It specifies that access is limited to the current assembly or types derived from the containing class.
  5. Private: It specifies that access is limited to the containing type.

Nullable: Nullable is a concept that allows a type to hold an additional value null.

Structures: The struct keyword is used for creating a structure.

Constructors: A constructor is a special method of the class which gets automatically invoked whenever an instance of the class is created.

Encapsulation: Wrapping up of data into a single entity.

Polymorphism: Same method many forms.

One parameter
No parameter
2 Parameters

Inheritance: One object acquires all the properties and behaviors of its parent object automatically.

Abstraction: Hiding the internal details of the process to end user.

Interface: Interface is a blueprint of a class.

Exception: Exception is a response to an exceptional circumstance that arises while a program is running.

Delegates: Delegate declaration determines the methods that can be referenced by the delegate. A delegate can refer to a method, which has the same signature as that of the delegate.

Namespace: The namespace keyword is used to declare a scope that contains a set of related objects.

Files:

Collections: Collections standardize the way of which the objects are handled by your program. In other words, it contains a set of classes to contain elements in a generalized manner.

Generic: Generic means the general form, not specific. In C#, generic means not specific to a particular data type. C# allows you to define generic classes, interfaces, abstract classes, fields, methods, static methods, properties, events, delegates, and operators using the type parameter and without the specific data type.

--

--