.NET Technology
Visual Basic used for Windows application.
1998 MS VB 6.0 released
1999 Microsoft starts new technology called Next Generation Windows Service(NGWS), which is advanced than vb 6.0.
2000 MS renamed NGWS AS .NET ; and released .NET 1.0 Beta Version(testing version)
2002 officially .NET 1.0 released
2003 .NET 3.0
2008 .NET 3.5
2010 .NET 4.0
2012 .NET 4.5 released
Introduction Visual Studio
.NET Technology is divided as 2 parts
1. .NET Framework (existing programs develop)
2. Visual studio (develop by experience)
.NET Framework
- .NET Framework provides necessary run time services to run the .NET applications.
- .NET Framework includes with various components such as CLS,CTS,CLR,CIL etc.
Visual studio(VS)
- VS is used to develop the .net applications
- It is called as "source code editor" for .net applications.
- It is called as " IDE " ( Integrated development environment)
- VS is used to create any .net projects(like C# .Net projects,ASP .NET projects, VB.NET projects etc)
- Each version of visual studio is compatible with specific .NET version
STEPS FOR INSTALLING "MICROSOFT VISUAL STUDIO 2012 PROFESSIONAL
GO TO> http://http://www.microsoft.com/visualstudio/eng/products/visual-studio-professional-2012
>>click on download >>click on "install now">>click on save file>>double click on "vs professional.exe">>installation starts.
>>>start>>>all programs>>>microsoftstudio 2010>>>opening visual studio.
short cut >>start>run>>devnv(development environment)
SYSTEM REQUIREMENTS OF VISUAL STUDIO 2012
OPERATING SYSTEM WINDOWS 7 OR WINDOWS 8
WINDOWS SERVER 2008 R2 OR WINDOWS SERVER 2012
PROCESSOR 1.6 GHZ OR ABOVE
RAM 1 GB
HARD DISK 10 GB FREE SPACE
Advantages of Visual Studio
- Intelli sence: start typing your code,to get matching words automatically. To type a word ,select it and press tab key.
- Automatic Error Detection: if there any syntax error visual studio automatically highlights it with "Red underline" .
- Code snippects: you can save important code in toolbox and you can drag and drop the same later.
- Drag and Drop Design: you can easily design the controls in the winforms and webforms
C# .net
- Introduction to c# .net
- Solution and Projects
- .Net Framework components
- C#.Net core
- C#.Net oops
- C#.Net win forms
- ADO .net
- C# .Net windows services
1.Introduction to c#.net
- C# .Net is one of the top most programming language used today
- It is a part of .net
- It is advanced than C and C++
- I t is used to develop:
- console application :Run on the Dos prompt window
- windows application :
- windows services: :
Features of c# .net
- It is an object oriented programming language supports classes,objects, data encapsulation,data abstraction, polymorphism,inheritance
- It is case sensitive language, that means you must type your code in proper case
- It is a "C" family language, it derives most of the programming style and concepts from c language.
- It is "compiler-based language", the code should be compiled before executed, name of c# .net compiler is "csc"(cshorp compiler)
- It supports graphical application development, that means we can develop the windows for ms application.
2. Project
- An application is a project which is a collection of files.
C#.NET
project1
--file1.cs
--file2.cs (cs=cshorp)
Solution
namespace namespace1
{
class class 1
}
Static Void Main(sting[]args)
{
// some code here
}
}
}
Note: namespace is collection of classes same as "packages" in java
steps for develop
>>open visual studio>>start>>all programs>>msvs 2010
open file--new project
select the language --visual c#---select console application---project1---location(location of the folder)
solution name and project name can be same but different.
namespace project1
{
class program
{
static void main(string[]args)
{
system.console.write("wecome to c#');
system.console.readkey();
}
}
}
compile the the program
Build menu--build solution(ctrl+shipt8
After compilation
Debug menu---start debugging f5
example no2
Write a program to read principle amount, no of year rate of interest from console window and also calculate "simple interest"
create a new console application using vs 2010
namespace simple interest calculator
{
class program
{
static void main(string[]args)
{
// declare variables
double p,n,r,si ;
// read values from keyboard
system.console.write("enter principle amount");
string temp1= system.console.readline();
system.console.write("enter no of years");
string temp2=system.console.readline();
system.console.write("enter rate of interest");
string temp3=system.console.readline();
//convert values into double data type
p=system.convert.todouble(temp1);
n=system.convert.todouble(temp2);
r=system.convert.todouble(temp3);
si=p*n*r/100;
system.console.writeline("simple interest is:"+si);
system.console.readkey();
}
}
}
Solution
- Solution is a collection of projects.
Ex:-Banking Solution ----- Online banking project
----- Offline banking project
----- Mobile banking project
finally a solution will be provided for the clients
Console application : It runs on " console window "
>> Console = Dos prompt>>It is useful to understand "c#.net programming basics"
Class: A class is a collection of variables and methods.
----- Offline banking project
----- Mobile banking project
finally a solution will be provided for the clients
Console application : It runs on " console window "
>> Console = Dos prompt>>It is useful to understand "c#.net programming basics"
Class: A class is a collection of variables and methods.
- Variables are used to store the values.
- Methods (functions) are used to perform manipulations on the variables.
class customer
{
int Customer id;
char Customer Name [3];
char Phone[10];
Void Read Customer()
{
//some code here
}
Void Display Customer()
{
// some code here
}
Void Main()
{
}
- A c# .net program should contain at least one class, with a method called "main()" method.
- Main() contains your applications logic of your program.
namespace namespace1
{
class class 1
}
Static Void Main(sting[]args)
{
// some code here
}
}
}
Note: namespace is collection of classes same as "packages" in java
steps for develop
>>open visual studio>>start>>all programs>>msvs 2010
open file--new project
select the language --visual c#---select console application---project1---location(location of the folder)
solution name and project name can be same but different.
namespace project1
{
class program
{
static void main(string[]args)
{
system.console.write("wecome to c#');
system.console.readkey();
}
}
}
compile the the program
Build menu--build solution(ctrl+shipt8
After compilation
Debug menu---start debugging f5
example no2
Write a program to read principle amount, no of year rate of interest from console window and also calculate "simple interest"
create a new console application using vs 2010
{
class program
{
static void main(string[]args)
{
// declare variables
double p,n,r,si ;
// read values from keyboard
system.console.write("enter principle amount");
string temp1= system.console.readline();
system.console.write("enter no of years");
string temp2=system.console.readline();
system.console.write("enter rate of interest");
string temp3=system.console.readline();
//convert values into double data type
p=system.convert.todouble(temp1);
n=system.convert.todouble(temp2);
r=system.convert.todouble(temp3);
si=p*n*r/100;
system.console.writeline("simple interest is:"+si);
system.console.readkey();
}
}
}
What is Main() method:-
* In Main() the letter 'M' must be capital.
* It can't return value
That's way, it must be always "void "
The keyword void says, Main() method doesn't return any value.
* It must be static
Generally a static method can be called, with out creating any object for the class.
System will internally call your Main() method without creating any object for your class.
* It can receive " command line arguments", using String[].
System.Console class:-
* It is a predefined class, available in .net.
Console is a class, which is a member of system namespace.
* It contains necessary methods, that are usefull for developing console applications.
Ex:
Write(), WriteLine(), Readkey() etc.
C Methods C # Methods
printf() Write() and WrineLine()
scanf() ReadLine()
clrscr() Clear()
getch() ReadKey()
Class Console
{
//above mentioned c# methods
}
final statement;
System.Console.WriteLine("hai");
- Main() is a method (also called a function).
- It is the entry point of the program.
- Execution always starts from " Main() ".
- An application should have one Main().
* In Main() the letter 'M' must be capital.
* It can't return value
That's way, it must be always "void "
The keyword void says, Main() method doesn't return any value.
* It must be static
Generally a static method can be called, with out creating any object for the class.
System will internally call your Main() method without creating any object for your class.
* It can receive " command line arguments", using String[].
System.Console class:-
* It is a predefined class, available in .net.
Console is a class, which is a member of system namespace.
* It contains necessary methods, that are usefull for developing console applications.
Ex:
Write(), WriteLine(), Readkey() etc.
C Methods C # Methods
printf() Write() and WrineLine()
scanf() ReadLine()
clrscr() Clear()
getch() ReadKey()
Class Console
{
//above mentioned c# methods
}
final statement;
System.Console.WriteLine("hai");
Methods
- Write(): It is used to print some information on the console window:and the cursor will not be moved to the next line
Sample code:System.Console.Write("hello");
- WriteLine(): It is also used to print some information on the console window and also cursor will be moved next automatically,after printing the output
Sample code: System.Console.WriteLine("hello");
- ReadKey(): IT is used to read a single key from keyboard. It is same as getch() in c language
Sample code:System.Console.ReadKey("hello");
- ReadLine(): It is used to read a string value as input from keyboard . It is similar to scanf() in c language. It can read "only strings" [your variable name=System.Console.ReadLine();]
- Clear(): It is used to clear the console screen,it is same as clrscr() in c language.
Sample code: System.Console.Clear();
Q) Write a program to demonstrate usage of "System.Console." and also escape sequence chars".
Output:
.net
c#.net
asp.net
vb.net
--- screen should be cleared--
enter your name: *****
welcome: ***** ( how to develop in c#)
project name console class demo
using system:
It used to import all classes of "system" namespace in other words, the
compiler understands that the programer is going to use the classes of
"system" namespace.
- System
- System.IO
- System.Data
- System.Data sql client
- System.Data.OleDb
- System.Windows.Forms
- System.Drawing
- System.Web
- System.Net
- System.Net.mail
- System.Web.Services
- System.Globalization
namespace Console Class Demo
{
Class program
{
Static Void Main( String[] args)
{
Console.WriteLine(".net" );
Console.WriteLine("\tc#.net");
Console.WriteLine("\tvb.net");
Console.WriteLine("\tasp.net");
// wait for somekey
Console.Write("press any key to continue");
Console.ReadKey();
//clear the screen
Console.Clear();
//read value from console
Console.Write("enter your name");
String person name=Console.ReadLine();
//show message
Console.Write("welcome",+ person name);
/* this statement used to wait for pressing some key*/
}
}
}
Escape sequence characters:
- These are the special characters, which is used to produce a special type of output
- These characters starts with "\"
- These are all taken from "c" language
- You can use characters within double quotes only
- Each escape sequence character produce some special output as follows.
\" "
\' '
\\ \
\n (cursor jumps to nextline)
\t tab space(few spaces)
Varibles:
- It is a named memory location in RAM
- Used to store a particular type of value.
No comments:
Post a Comment