Professional Documents
Culture Documents
A set of classes and‐or libraries used to implement the standard structure of an application for a
specific operating system is called as application framework.They provide structure and services
for application development. Application frameworks are extensible, modular, and reusable.
Microsoft programming infrastructure for creating, deploying, and executing applications and
services that use .NET technologies. .NET Framework comprises three major components -
Common Language Runtime (CLR), Framework Base Classes and ASP.NET .
Providing metadata
Enforcement of Security
Enhanced security
Versioning support
Debugging support
Security
Garbage Collection
Class Loader
Memory Layout
CLS is a subset of the Common Type System and a set of conventions for promoting
interoperability between programming languages and the .NET Framework. CLS details
conventions that must be followed by class library authors and by programming language
designers.
CTS is the .NET Framework specification for defining, declaring, and managing types in .NET
languages for the Common Language Runtime (CLR). All .NET components must comply with
the CTS specification.
FCL comprises the thousands of classes constituting the foundation of the .NET Framework. FCL
services include core functionality—collections, file and network I/O, system service access,
value types, etc.—, database interaction, desktop‐based application support—Windows Forms
—, Web‐based application support—Web Forms—, Web services support, and XML support.
JIT is the process of compiling MSIL code units just when needed at runtime. The JIT compiler in
the Common Language Runtime (CLR) compiles MSIL instructions to native machine code as
a .NET application is being executed. Compilation occurs when a method is called and is not
compiled more than once during program execution; because, JIT‐compiled code is cached in
memory.
It is, also called unsafe code, code that executes outside of the control of the Common
Language Runtime (CLR). Unmanaged code may perform unsafe operations such as pointer
arithmetic. Unmanaged code is used for accessing unmanaged memory, calling Windows APIs,
interfacing to COM components, and coding performance‐critical methods which avoid the
overhead of the CLR.
Data in memory allocated and deallocated by the Common Language Runtime (CLR). Managed
data can be accessed only by managed code.
Data allocated outside of the control of the Common Language Runtime (CLR). Unmanaged
data is accessible by both managed and unmanaged code.
Serialization can be defined as the process of storing the state of an object instance to a storage
medium. During this process, the public and private fields of the object and the name of the
class, including the assembly containing the class, is converted to a stream of bytes, which is
then written to a data stream. When the object is subsequently deserialized, an exact clone of
the original object is created.
Remoting provides a framework that allows objects to interact with one another across
application domains. The framework provides a number of services, including activation and
lifetime support, as well as communication channels responsible for transporting messages to
and from remote applications.
The statements which are not included for compilation by the compiler are called as comments.
They are used to enhance readability and understanding of code. C# permits two types of
comments, namely:
Single Line Comments
Begins with a double backslash (//) symbol. Ex: //Main method begins Multi Line Comments
This starts with /* characters and terminates with */. Ex: /* Program - Testing Delegates
Keywords are an essential part of a language definition. They implement specific features of the
language. They are reserved, and cannot be used as identifiers except when they are prefaced
by the @ character. There are 79 keywords in C#. Ex: public, private, if, while etc..
Identifiers are programmer‐designed tokens. They are used for naming classes, methods,
variables, labels, namespaces, interfaces, etc. C# identifiers enforce the following rules:
They can have alphabets, digits and underscore characters. They must not begin with a digit
C# permits the use of keywords as identifiers when they are prefixed with a @ character.
Punctuators are symbols used for grouping and separating code. They define the shape and
function of a program. Punctuators or Separators in C# include:
Parentheses ()
Braces { }
Brackets []
Semicolon ;
Colon :
Comma ,
Period .
It includes class types, interface types, delegate types and array types. Reference variable
stores references to objects whereas the data of objects are stored in locations represented by
references. Reference variable points to an object allocated on heap. Reference variable can
have null value. One or more reference variables can be assigned with the same reference of an
object. Hence, operation on one reference variable may affect the object referenced by the
other reference variable.
A class is essentially a description of how to construct an object that contains fields and
methods. It provides a sort of template for an object and behaves like a basic data type such as
int. Classes provide a convenient approach for packing together a group of logically related data
items and functions that work on them.
Encapsulation provides the ability to hide the internal details of an object from its users. The
outside user may not be able to change the state of an object directly.
However, the state of an object may be altered indirectly using what are known accessor and
mutator methods. The concept of encapsulation is also known as data hiding or information
hiding.
Inheritance is the concept used to build new classes using the existing class definitions.
Through inheritance a class can be modified easily. The original class is known as base or
parent class and the modified one is known as derived class or subclass or child class. The
concept of inheritance facilitates the reusuability of existing code and thus improves the
integrity of programs and productivity of programmers.
Polymorphism is the ability to take more than one form. The behavior of the method depends
upon the types of data used in the operation. This is extensively used while implementing
inheritance.
26. What is the Characteristic of Inheritance?
1. A derived class extends its direct base class. It can add new members to those it
inherits.However, it cannot change or remove the definition on an inherited member.
2. Constructor and destructors are not inherited. All other members, regardless of their
declared accessibility in base class, are inherited.
All instance of a class contains a copy of all instance fields declared in the class and its base
classes.
It is an Event handling mechanism of .NET. To raise events, a class must define one delegate per
event type. To handle events, types must implement one event handler per event type.
Delegates can reference both instance and static methods. C# uses the delegate keyword.
Delegate declaration
Delegate instantiation
Delegate invocation
An event is a delegate type class member that is used by the object or class to provide a
notification to other objects that an event has occurred. The client object can act on an event
by adding an event handler to an event.
The type of an event declaration must be a delegate type and the delegate must be as
accessible as the event itself.
Error is a mistake that can make a program go wrong. An error may produce an incorrect
output or may terminate the execution of the program abruptly or even may cause the system
to crash. There are two types of error:
Compiler‐time errors
Run‐time errors
This is used in conjunction with Microsoft .NET platform and is a successor to visual basic sixth
version. Visual basic is used in conjunction with.NET Framework. This tool has a serious defect it
is not compatible with Microsoft visual basic sixth version. It has a huge library which assists
programmers.
.NET Frame work includes two languages which are language to IL compilers and in this C# and
VB.NET are provided. The importance and flexibility of these as better programming languages
is still questionable. Visual basic has been updated and revised to make it object oriented
whereas C# has concepts from many languages such as Delphi, Java, etc and syntax from C and
Java.
A Method is a procedure built into the class. They are a series of statements that are executed
when called. Methods allow us to handle code in a simple and organized fashion. There are two
types of methods in VB .NET: those that return a value (Functions) and those that do not return
a value (Sub Procedures).
34. How are the Fields, Properties, Methods, and Events related to class?
Fields, Properties, Methods, and Events are members of the class. They can be declared as
Public, Private, Protected, Friend or Protected Friend.
Fields and Properties represent information that an object contains. Fields of a class are like
variables and they can be read or set directly. For example, if you have an object named House,
you can store the numbers of rooms in it in a field named Rooms.
Public Class
End Class
Arrays are using for store similar data types grouping as a single unit. We can access Array
elements by its numeric index.
Structured exception handling is simply that — using a control structure containing exceptions,
isolated blocks of code, and filters to create an exception handling mechanism. This allows your
code to differentiate between different types of errors and react in accordance with
circumstances. In unstructured exception handling, an On Error statement at the beginning of
the code handles all exceptions.
Structured exception handling tests specific pieces of the code and, as exceptions occur, adapts
your exception-handling code to the circumstances that caused the exception. It is significantly
faster in large applications than unstructured exception handling and allows more flexible
response to errors as well as greater application reliability.
This code example is a simple Try...Catch block that first checks for ArithmeticException and
then checks for generic exceptions.
Imports System
Sub Main()
Dim x As Integer = 0
Try
Catch ex As ArithmeticException
MessageBox.Show(ex.Message)
Catch ex As Exception
MsgBox(ex.Message)
End Try
The ADO.NET classes are found in System.Data.dll, and are integrated with the XML classes
found in System.Xml.dll. When compiling code that uses the System.Data namespace, reference
both System.Data.dll and System.Xml.dll.