Разработка приложений на платформе Microsoft .Net: Методическое пособие

Embed Size (px)

Text of Разработка приложений на платформе Microsoft .Net:...

  • Microsoft.Net 1

    & SoftLine Academy, 2006 . ..

    Microsoft .Net

    18 . Microsoft .Net

    Windows-, Web-. , Microsoft .Net Microsoft Visual Studio . 2005 .Net v2.0 Visual Studio 2005 .

    Microsoft .Net. : - C#, Windows-, . . ASP.NET 2 Web Services.

  • Microsoft.Net 2

    & SoftLine Academy, 2006 . ..

    Microsoft

    .Net ................................................................................................................................................1 ........................................................................................................................2 Microsoft .Net .................................................................................................3 #. .....................................................................................3 ...................................................................................................3 ......................................................................3 ................................................................................................4 .............................................................................................................5 .............................................................................................................5 ...................................................................................................................5

    ....................................................................................................................6 ..............................................................6 .............................................................................................7

    ...............................................................................................8 ........................................................................................................8 ...........................................................................................................8

    ..........................................................................................................................9 ..................................................................9 ...........................................................................................................................10 ..........................................................................................................................11 ...............................................................................................................11 .......................................................................................................................11

    1 ................................................................................................12 Windows Forms............................................................................................12 Form, MessageBox ....................................................................13 Form ...............................................................................................................13 MessageBox ..................................................................................................14 ToolBox ..............................................................................14

    ...............................................................................16 .............................................................................................................................17

    2 ................................................................................................17 ADO.NET..........................................................................................................................17 ADO.NET...............................................................................................18 .................................................................................19

    .................................................................................................19 ..................................19 ..............................................................................................19

    3 ................................................................................................21 ...................................................................................................22 .................................................................................................22 .................................................................22 ..................................22 ....................................................................................................................22

  • Microsoft.Net 3

    & SoftLine Academy, 2006 . ..

    Microsoft .Net Microsoft .Net

    . 5 . , , . , . , , [1]. Microsoft .NET -. .Net Microsoft .Net Framework , .

    .NET (CLR, common language runtime). Java Runtime Environment, . , (managed code) , .NET runtime. Microsoft Intermediate Language (MSIL, IL). , , .. .

    . , (versioning).

    #. .Net ,

    . C#, , . C# ++ Java, , , .

    Hello, world!. class Hello {

    public static void Main(string[] args) {

    System.Console.WriteLine("Hello, world!"); }

    } 1. Hello,world C# - .

    - Main. . , DLL. . 1.

    , .Net . ,

    .Net Framework , - Framework Class Library (FCL). .

  • Microsoft.Net 4

    & SoftLine Academy, 2006 . ..

    /\. , (ADO.NET), (ASP.NET), windows (Windows Forms), XML (DOM, XSD, XSLT, /, ADO.NET), (System.Net), (remoting), COM+ (Enterprise Services, Serviced components), (System.Security.Cryptography).

    , . System.

    System.Console.WriteLine("Hello, world!"); "Hello, world!"

    WriteLine Console, System. , . , . . .

    using System; class Hello { public static void Main(string[] args) { Console.WriteLine("Hello, world!"); } } 2. Hello,world using System using,

    , . , , , using , .

    C# csc.exe (C Sharp

    Compiler). , Windows XP .Net Framework v2.0, c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727. .Net Framewrok 2 net. %net%\csc.exe. . .

    /t:exe /t:winexe /t:library /t:module

    Windows

    /t:exe . , , %net%\csc hello.cs, hello.exe.

  • Microsoft.Net 5

    & SoftLine Academy, 2006 . ..

    1. , Main . , , .

    C# .

    : sbyte, byte, char, short, ushort, int, uint,

    long, ulong, float, double, decimal.

    - -, .

    . enum [: ] { 0 = 0,,N = N } 1.

    , : enum DayOfWeek {Monday=1, Tuesday, Wednesday, Thursday, Friday, Saturday Sunday};

    . ,

    . , :

    ; ; .

    , , , .

    struct Point { public int x,y; public Point(int p1, int p2) { x=p1; y=p2; }

    - (value-types)

    (reference types)

    (int, float,) (enum) (struct)

    (class) (delegate) (interface) (System.String) System.Object (System.Array)

  • Microsoft.Net 6

    & SoftLine Academy, 2006 . ..

    } struct Circle { public Point Centre; public int Radius; public Circle(int p1,int p2,int p3) { Centre=new Point(p1,p2); Radius=p3; } } 3. , . .

    C# Visual Basic . C#

    7 : , , , , , .

    ,

    static. . , . . .

    class Variables { static int N1; int N2; public Variables(int p1, int p2) { N1=p1; N2=p2; } public static void Main(string[] args) { Variables var1 = new Variables(10,20); System.Console.WriteLine(" .: "+Variables.N1.ToString()); Variables var2 = new Variables(100,200); System.Console.WriteLine(" .: "+Variables.N1.ToString()); System.Console.WriteLine(" .: "+var1.N2.ToString()+" "+var2.N2.ToString()); } } 4. var2 N1 , ..

    .

  • Microsoft.Net 7

    & SoftLine Academy, 2006 . ..

    , .

    . , . class Variables { public static void Main(string[] args) { int a; { int b; } { int a; // , int b; // , .. } } } 5. ( )

    class Variables { public static void Main(string[] args) { // int a; { int b; } { int a; int b; } } } 6. ( )

    , .

  • Microsoft.Net 8

    & SoftLine Academy, 2006 . ..

    System.Console. Console.WriteLine(Hello, World!); Console.Write(Hello, World!); .

    . Console.WriteLine({0}, {1}{2},Hello,World,!); . {N,M:F}, : N ( ); M ; F ; R . : - ; D - ; E - 1e+3; F - 123.456; G - ; N - 123,456,789.5; X - .

    C# ,

    . int i = Console.Read(); string str = Console.ReadLine(); . string str = Console.ReadLine(); int i = Int32.Parse(str); float f = Float.Parse(str); double d = Double.Parse(str);

  • Microsoft.Net 9

    & SoftLine Academy, 2006 . ..

    System.Array. CLR

    : ; ; (jagged) .

Recommended

View more >