OOP Types and Features 1. Class: Class Is A Collection of Data-Member and Member Functions
OOP Types and Features 1. Class: Class Is A Collection of Data-Member and Member Functions
Class is a collection of data-member and member functions. Class will not occupy any
memory space; hence it is only logical representation of data by object
declaration.
Classes that can be used to instantiate objects are called concrete classes.
2. Object:
3. Abstraction
Process of hiding the details of a class from outside of the program world is
called as data abstraction. Advantage of data abstraction is security.
4. Encapsulation
process of wrapping up of data and functions into a single unit is called as data
encapsulation.
5. Inheritance
Creating a new class from an existing class as well as utilizing the property and
functionalities of an existing class is called as Inheritance.
The class which is inherited is called as the Base class & the class which inherits is
called as the Derived class. They are also called parent and child class.
6. Polymorphism
It is a feature, which lets us create functions with same name but different
arguments, which will perform different actions. That means, functions with same
name, but functioning in different ways (function overloading). Or, it also allows us to
redefine a function to provide it with a completely new definition (function
overriding).
Constructor is a special function in a class when that is called a new “object” of the
class is created.
A destructor is also a special function which is called the created object is deleted.
2.
3. State Management can be defined as the technique or the way by which we can maintain / store
the state of the page or application until the User's Session ends.
1. Client-side Management
o Viewstate
o Hidden field
o Cookies
o Control State
o Query Strings
2. Server-side Management
o Session State
o Application State
1.1. Viewstate is used to maintain or store user data temporarily after a post-back.
1.2. A hidden field is used for storing small amounts of data on the client side. It is invisible in the
browser.
1.3. Cookies is a small text file that is stored in the user's hard drive using the client's browser. it only
stores information such as sessions id's, some frequent navigation or post-back request objects.
The cookie’s access depends upon the life cycle and expiration of that specific cookie file.
1.3.1. Persistent Cookie
Cookies having an expiration date is called a persistent cookie. This type of cookie reaches
their end as their expiration dates comes to an end. In this cookie we set an expiration date.
1.3.2. Non-Persistent Cookie
Non-persistent types of cookies aren't stored in the client's hard drive permanently. It
maintains user information as long as the user access or uses the services. It’s simply the
opposite procedure of a persistent cookie.
1.4 Control state is based on the custom control option. For expected results from CONTROL STATE
we need to enable the property of view state. As I already described you can manually change those
settings.
1.5 Query Strings used for holding some value from a different page and move these values to the different
page. The information stored in it can be easily navigated to one page to another or to the same page as
well.
1. If the information that we want to be accessed or stored globally throughout the application, even
if multiple users access the site or application at the same time, then we can use an Application
Object for such purposes.
2. It stores information as a Dictionary Collection in key - value pairs. This value is accessible across
the pages of the application / website.
3. There are 3 events of the Application which are as follows
o Application_Start
o Application_Error
o Application_End
Session is one of the most common way which is being used by developers to maintain the state
of the application. The Session basically stores the values as a dictionary collection in key/value
pairs. It completely utilizes server resources to store the data. It is a secure way of storing data,
since the data will never be passed to the client.
For each and every user, a separate Session is created, and each and every Session has its Unique
ID. This ID is being stored in the client's machine using cookies. If there are multiple users who are
accessing a web application, then for each user a separate Session is created. If a single user logs
in and logs out the Session is killed, then if the same user again logs into the application, then a
new Session ID is being created for the same user.
The Session has a default timeout value (20 minutes). We can also set the timeout value for a
session in the web.config file.
C# Data Types
.NET Size
Alias Type Type (bits) Range (values)
decimal Decimal Precise fractional or integral type that can represent 128 (+ or -)1.0 x 10e-28 to 7.9 x 10e28
decimal numbers with 29 significant digits