Anda di halaman 1dari 7

Module 1

Introduction to Microsoft Technologies and .NET

1. Microsoft Technologies
Microsoft Corporation is an American multinational
technology company from Redmond, Washington, whose goal is
to build best the best productivity tools and services for a
mobile-first, cloud-first world.
Microsoft has become well known for the operating system
family Windows, first launched in 1985. By 2016, Microsoft has
released multiple versions for personal use (most notably
Windows XP, Windows 7), Windows 10 being the latest
release.

The company also releases server operating systems


(Windows Server), and Windows Server 2016 release is
expected in early 2016.
Besides the operating systems, Microsoft also develops
office productivity tools like Office (who also has an online

version Office 365), business analytics, enterprise resource


planning and customer relationship manager: Microsoft Power
BI and Microsoft Dynamics.

An important part of the cloud-first, mobile-first approach is


the cloud. Microsoft built an interesting cloud platform Azure
an integrated collection of cloud services, analytics, computing,
databases, mobile, networking, storage and web.

You can publish web applications directly form Visual


Studio, you can create virtual machines with any operating
system, host SQL and NoSQL databases, create mobile backends for any mobile application (Android iOS, Windows10), VPN,
even do machine learning.
Everyday new integrated cloud solutions are added in the
Marketplace for anyone to use.
You can activate your Azure subscription
DreamSpark by verifying your academic status here.

through

2. .NET and C#
.NET is a framework developed by Microsoft designed to
provide an environment in which you can develop almost any
type of application be it a classic desktop application, a
Windows Presentation Forms application, a dynamic web page
served by a web server, a database access component, cloud
applications for Microsoft Azure or even parallel and distributed
applications.
To understand the significance of .NET, keep in mind that
while Windows has evolved a lot in the past 20 years, at their
core lies the same Windows API.
With every new release of the .NET framework (.NET
1,2,3,4,4.5,4.6) new and important functionality was added,
while the old one was kept in order to maintain backwards
compatibility.
When Windows 8 launched, the main API got a
replacement with a component called Windows Runtime, but it
was still based on the familiar API. Similarly, many current
Microsoft technologies present in the .NET framework have
evolved from other similar technologies rather than replaced.
This evolutionary approach to software development
was preferred by Microsoft in order to maintain support for older
programs that were written for Windows. Surely, if the old code
hadnt worked from one version to the other, the operating
system family wouldnt have had the same success.
C# is a language that was designed by Microsoft with one
simple goal: to represent the base language for building
software on the .NET platform; regardless of the fact that you
are writing a web application, or a console service, or a classic
desktop application, you can achieve it by using C#.
While you can still create applications for the framework
using Visual Basic and a C++ (Microsoft developed on top of
the C++ standards and created Managed C++), it is rather
easier to code it in C#.
Advantages of the .NET platform:
object-oriented approach

language independence all languages that are


supported by the framework (C#, managed C++ and
Visual Basic) are compiled to something similar to
the Java ByteCode Intermediate Language this
means that you can write a part of the program in C+
+ (some parts that must be very time efficient), then
a module in Visual Basic and then have an interface
built using C#.
Visual Studio when developing for the .NET
framework you can use Visual Studio an integrated
software development environment which contains
everything you ever need to create applications for
the .NET framework (and not only!).
For more information about C# and the .NET framework read
chapters 1 and 2 Professional C# 5.0 and the .NET 4.5.1!

3. Hello World Your first C# program


This part of the course focuses on creating a solid ground
for developing modern web applications using Microsoft
technologies. In order to achieve this, one must have a solid
understanding of object-oriented design (in general) and of
C# (in particular).
In order to begin programming complex C# applications,
we will start with a version of the traditional Hello World
program that simply displays the string Hello World!

//This is a single line comment in C#


using System;
namespace HelloWorld
{
class Program
{

static void Main(string[] args)


{
Console.WriteLine("Hello, World!");
Console.ReadLine();
}
}

Comments
The first line of the program contains a comment. Similar
to C, C++, Java or JavaScript, in C# you can comment:
- a single line done by adding // at the beginning of
the line
//ThisisasinglelinecommentinC#

- a block of code done by enclosing it between /* and


*/
/* This is a multiline comment.
It can be stretched across multiple lines */

The first few lines in the code relate to namespaces. Using


a namespace is a way to group together related classes. All
code within the braces that follow is part of that namespace.
The using keyword specifies a namespace where the
compiler should search for any classes that might be used in
your code. It has the same purpose as the import statement in
Java and the using namespace statement in C++.

Namespaces
The very first line of actual code (not the comment) is
usingSystem.
The reason for the presence in our code is that you are going to
use a library class called System.Console . The using System
statement enables you to refer to this class simply as Console.
Without the using statement, you would have to call the full
name, including the namespace in our case, for each console
print you would have to write System.Console.WriteLine();

The standard System namespace is the place where most


common .NET types are. The important thing to understand is
that everything you do in C# is based on .NET! In this case, you
are using a method from the class Console within the System
namespace to print a line on the screen. C# has no built in
keywords for input or output, it is completely based upon the
.NET framework.
Next, we declare a class, lets call it Program, but because
it is placed in a namespace called HelloWorld, the fully
qualified name will be HelloWorld.Program.
All C# code must be contained in a class. The class
declaration consists of the class keyword, followed by the name
of the class and braces. The code must be inside the braces.
Next, we declare a method called Main (notice the capital
M). Every executable written in C# (Windows applications,
services) must contain an entry point. (You can have multiple
classes that contain a Main method, but you have to specify the
compiler which one to use as entry point for your application).
[modifiers] return_type MethodName(argument list)
{
//Code
}
(For a full list of modifiers check this resource)
Now we come to the actual code of this program:
Console.WriteLine("Hello, World!");
Console.ReadLine();
Here, we simply call the WriteLine method from the
Console class that resides in the System namespace, and we
call it with a string argument, the string we want to be printed
on the console. (We are able to call methods without
instantiating an object of the class first because this is a static
method).

The next lines purpose is to keep the console from


disappearing. Normally, this method is used to read the users
input, but here we use it to make the application wait for a
carriage-return.
There you have it! You just had your first basic program!

Anda mungkin juga menyukai