Beginner with c # 4

zhaozj2021-02-08  215

1 £ 4 ¤¤¤ ¨òåà ðí £ ¨predefined type £ ©

C # ì¹ ¹ © áëò »ïμá𤤨¨ò¨åà ðí¡¡ £ ëüãçóëc / c óð2 »éùïàëæμÄμØ · 1/2. £ ¤¨ ¨òåòýóàààííóðobjectoístring ¡ £

Objectààðíêçëùóóæääûûûà ðμμ »'' ¡ £

¤¤¤ ¨òåà ðí ° üà ¨ · ûoseêýý¡¡¡ ¢ þ · ûoseêêý¡¡¡¡¡¡¡¡ ¢ ¸ ¸ ¸¡ μã. ¢21/1/1/14/4 ¢ × ö · ûoíê® 1/2 øöêêý¡¡¡ £ · ûoseåêýóð £ osbyte¡ ¢ short¡ ¢

Intoílong £ »þ þ ûoseåêýó £ obyte¡ ¢ ushort¡ ¢ uintoíulong £ »¸¡ μãýóð £ ofloatoídouble ¡ £

21/4ûûà ðí4íïññ »¸ö¿ ª¹Ø £ ¬¬ »óðá/1 ö ×'¬¬ £ otrue» òfalse¡ £ C # ôô21/100 ûûμäªçó ± ±c / c ñïñ £ ¬¬javaààëææ¡¡ £

Ôúc # öðfalse2 »μèóú0 £ ¬trueò22» μèóú1 £ »falseoítrue¶4êçμ ¥ àà öàë3öà'μä» ¸öμ¡ £ ñ¹¹c / c μäíøóñ

¶4ªªμà £ o * /

INT i = 0;

IF (i = 0) {// bug: ó| ¸ãç (i == 0)

....

}

/ * Êçã »óðîêìâμÄ¡ £ μ «ôúc # öð» áòý · ¢ ò »¸ ö ±ò''íîó £ ¨error CS0029: Cannot Implicitly Convert

Type 'int' to 'Bool' £ © £ £ μ ± è »£ ¬õññþþþéüáëò» μãã »óð ± Øªªμäáé» îðôô¡ £ òççôùò22 »ÄÜ õññ £ o * /

String Str;

....

IF (str = console.readline ()) {

Console.writeline ("Your Comments Are: {0}", STR);

....

/ * ØØ ± øðë £ o * /

Using system;

Class booltest

{

Static void main () {

String str = console.readline (); // ò2¿ Éòô £ oString Str;

IF (str == ") // if ((str = console.readline ()) ==" ")

Console.writeline ("i can't read your comments. Please tell me sadhing! O.k.?");

Else

Console.writeline ("Your Comments Are: {0}", STR);

}

}

/ *

Îò3áëò »õõ¤¤¤¨¨òååà ðμμä¼¼ ±¹ © 'ó¼ò2î¿ 1/4 ¡ £

TYPE DESCRIPTION EXAMPLES

Object The Ultimate Base Type of All Other Types Object O = New Stack ();

String string type; a string is a sequence of string s = "hello";

Unicode Characters

Sbyte 8-bit signed integral type sbyte val = 12;

Short 16-bit Signed Integral Type Short Val = 12; INT 32-bit Signed Integral Type Int Val = 12;

Long 64-bit signed integral type long Val1 = 12;

Long Val2 = 34L;

BYTE 8-bit unsigned integral type byte VAL1 = 12;

BYTE VAL2 = 34U;

Ushort 16-bit unsigned integral type ushort var1 = 12;

Ushort Val2 = 34U;

UINT 32-bit unsigned Integral Type uint VAL1 = 12;

UINT VAL2 = 34U;

Ulong 64-bit unsigned integral type ulong Val1 = 12;

Ulong Val2 = 34U;

Ulong Val3 = 56L;

Ulong Val4 = 78UL;

FLOAT SINGLE-Precision Floating Point Type Float Value = 1.23F;

Double Double-Precision Floating Point Type Double Val1 = 1.23

Double Val2 = 4.56d;

Bool Boolean Type; A Bool Value Is Either Bool Value = True;

True Or False

Char Character Type; a char value is a unicode char value = 'h';

Character

Decimal Precise Decimal Type with 28 Significant Digits Decimal Value = 1.23M;

Äã2¿ Éòô × ô¶ ¨¨òå (ô (μ μä줤¨¨òòà àí £ ¬¬ Éòôõõñ £ o * /

Using system;

Struct Digit

{...}

Class test

{

Static void testint () {

INT A = 1;

INT B = 2;

INT C = A B;

Console.writeLine (C);

}

Static void testdigit () {

Digit a = (DIGIT) 1;

Digit B = (DIGIT) 2;

Digit c = a b;

Console.writeLine (C);

}

Static void main () {

Testint ();

TestDigit ();

}

}

/ *

Õõ »1/2úóðμã³áãæ¡ ££ o £ ¨

转载请注明原文地址:https://www.9cbs.com/read-2820.html

New Post(0)