C# Module 1
C# Module 1
C# Module 1
NET
Xamarin / Mono is a .NET implementation for running apps on all the major mobile
operating systems, including iOS and Android.
https://dotnet.microsoft.com/learn/dotnet/what-is-dotnet-framework
a) C / Win32 Language:
Disadvantages:
i. Concept of Pointers is the powerful feature. But, they are highly insecure and makes it vulnerable.
ii. The concept of reusability is achieved only through functions, so it makes more complex for coding big
projects and hence lot of time is wasted.
iii. C developers have to concentrate on memory management as there is no automatic Memory
management.
iv. Since C is structured language, it lacks all the benefit of object oriented programming
v. C doesn't perform Run Time Type Checking. It only does compile time type checking.
vi. Besides all these, C is a powerful language, that's why, a majority of Operating Systems are built using C.
Drawbacks:
Not truly object oriented
Not suitable for developing web technologies
It does not support versioning i.e., creation and management of multiple versions of
Software.
It is not type-safe. It means the following
• Arrays are unbound.
• Compile time errors are not generated when uninitialized arrays are used
• It still support pointers which will leads to major errors in programs and also it makes highly insecure
Mr. Prashant Ankalkoti, Faculty, MCA Dept., JNNCE 12
c) Visual Basic 6.0:
Advantages:
VB was originally designed as a programming language for non-programmers. To that
end, the syntax was designed to read more like natural language sentences than
instructions to a computer.
There is no need to specify the type of a variable, or even declaring the variable itself.
Drawbacks of VB are:
Cross-Platform Support: Specifies that any windows platform that supports CLR can execute
.NET application, that is, .NET application enables interoperability between multiple Windows
operating systems.
Language Interoperability: Enables code written in different languages to interact with each
other. This allows reusability of code and improves the efficiency of the development process.
Mr. Prashant Ankalkoti, Faculty, MCA Dept., JNNCE 15
Automatic Management of Resource: In .NET, no need to manually free the application
resources, such as files, memory, network, and database connection because .NET
Framework provides a feature called CLR that automatically tracks the resource usage
and helps you in performing the task of manual resource management.
Ease of Deployment: In most cases, to install an application, you need to copy the
application along with its components on the target computer. But in .NET, applications
are deployed in the form of assemblies that’s why, do not affect the existing
applications. Therefore, registry entries are not required to store information about
applications and also version problem is eliminated in .NET Framework.
Therefore, you can say that the .NET Framework 4.0 is designed to address the latest needs
of the developers.
The architecture of .NET Framework 4.0 mainly consists of components of .NET Framework
2.0 and 3.0 with few enhancement as shown in figure 1.1.
i. When you compile source code by selecting .NET aware compilers such as Visual Basic, C#,
Visual C++, J#, or any of the third party compilers, such as COBOL, Perl or Eiffel.
ii. The .NET aware compiler converts source code in to binaries that are called as assemblies.
The assembly can be either *.dll or *.exe depending on the entry point defined in the
application.
NOTE: IL(Intermediate Language) code is also known as MSIL(Microsoft IL) / CIL(Common IL)
iv. The next level of compilation happen just before the application is executed. At this point, if
loader detects an IL code it loads mscoree.dll which denotes Runtime Execution Engine(CLR).
vi. Base class Library (mscorlib.dll): This library encapsulates various primitives such as file
IO, Data Access, Threading, XML/SOAP etc. When building .NET binaries you always make use
of this particular assembly.
• Add controls to the forms and raise events, such as mouse-click, which is handled by
event handlers in an application.
Greater Scalability: Specifies that the session states in ASP.NET are maintained in a
separate process on a different machine or database. This enables cross-server sessions
to occur, solving the problem of web forms when more web servers need to be added as
the traffic grows.
Cookie-less Sessions: Specifies that ASP.NET stores the session even when the cookies in
a Web browser are disabled. In such a case, the session ID is passed as a part of the
Uniforms Resource Locator (URL).
Mr. Prashant Ankalkoti, Faculty, MCA Dept., JNNCE 43
AJAX, which is also known as Atlas, is used as an extension for ASP.NET to develop and
implement the AJAX functionality. ASP.NET AJAX has both side client and server components
to develop the Web applications, which can update the information on a Web application
without reloading the page completely.
Advantages of using AJAX:
• Asynchronous: Enables asynchronous calls to the Web server without making the users
wait for the data.
• Minimal transfer of data: Helps in sending only a part of the modified data to the web
server to minimize the network traffic and perform the operations quicker.
• Minimal processing on the Web server: Minimizes the processing on the Web server as only
the necessary data needs to be sent. Now, the server is not required to send a full page
back to the user.
• Context: Reduces burden on the server by sending a request back to the server through the
client-side script. AJAX-based applications implement partial page post backs instead of
full page post backs, which reduce the data traffic between the client and server.
Mr. Prashant Ankalkoti, Faculty, MCA Dept., JNNCE 44
1.12 ADO .NET:
ADO.NET is a technology used for working with data and databases of all types.
It provides access to data sources, such as Microsoft SQL Server, data sources exposed
through OLE DB, and Extensible Markup Language (XML).
Advantages:
• Disconnected Data Architecture: Implies that applications connect to the database only
when data needs to be retrieved or modified. After the database operation has been
performed, the connection to the database is closed. To perform any database operation
again, the connection with the database will have to be re-established.
Cached Data in Datasets: Follows a disconnected architecture for accessing or modifying
data. The data is accessed and later stored in the datasets. A dataset is a cached set of
database records, which is independent of data source. Even when you are disconnected from
the database on which you are working, you can make modifications in the database.
Transfer of Data in XML Format: Transfers data from a database into a dataset and from
the dataset to another components using XML, which is the standard format used for
transferring data in ADO.NET.
Interaction with the Database through Data Commands: All operations on database are
performed, such as retrieving, modifying, or updating of data using data commands. A data
command is either a
Activities: Receives some parameters from the developer, execute the actions specified in
the parameters, and then the flow is transferred to the next activity.
Workflow Designer: Designs workflows by placing activities within the workflow model.
One interesting feature is that it can be re-hosted within any Windows Forms application.
Rules Engine: Enables declarative, rule-based development for workflows and any
.NET application to be used.
Rules:
Starts with a letter or an underscore and ends with a character.
Can have letters, digits and underscores.
Must not be a reserved word.
Must be a complete word without any blank spaces.
Example: sum, SUM, _sum
Keywords are the reserved words whose meanings are predefined to the C# compiler.
• You cannot use keywords as variable, methods and properties
• If you want to use the keywords as identifiers, prefix the keyword with @ character.
Unboxing is the reverse of boxing. It is the process of converting a reference type to value
type. Unboxing extract the value from the reference type and assign it to a value type.
Unboxing is explicit. It means we have to cast explicitly.
object o = 10;
int i = (int)o; //performs unboxing