国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

Beginner with c# 4

2024-07-21 02:20:01
字體:
來源:轉載
供稿:網友

1¡£4 ô¤¶¨òåààðí£¨predefined types£©

c#ìṩáëò»ïµáðô¤¶¨òåààðí¡£ëüãçóëc/c++óð²»éùïàëæµäµø·½¡£ô¤¶¨òåòýóãààðíóðobjectºístring¡£
objectààðíêçëùóðæäëûààðíµä»ù´¡¡£

ô¤¶¨òåààðí°ü਷ûºåêý¡¢îþ·ûºåêý¡¢¸¡µã¡¢²¼¶û¡¢×ö·ûºíꮽøöæêý¡£·ûºåêýóð£ºsbyte¡¢short¡¢
intºílong£»îþ·ûºåêýóð£ºbyte¡¢ushort¡¢uintºíulong£»¸¡µãêýóð£ºfloatºídouble¡£

²¼¶ûààðí¾íïñò»¸ö¿ª¹ø£¬ö»óðá½öö״쬣ºtrue»òfalse¡£c#¶ô²¼¶ûµäòªçó±èc/c++ñï¸ñ£¬óëjavaààëæ¡£
ôúc#öðfalse²»µèóú0£¬trueò²²»µèóú1£»falseºítrue¶¼êçµ¥¶à·öàë³öà´µäò»¸ööµ¡£ñ§¹ýc/c++µäíøóñ
¶¼öªµà£º*/
int i = 0;
if (i = 0) { // bug: ó¦¸ãêç (i == 0)
....
}
/* êçã»óðîêìâµä¡£µ«ôúc#öð»áòý·¢ò»¸ö±àòë´íîó£¨error cs0029: cannot implicitly convert
type 'int' to 'bool'£©¡£µ±è»£¬õâñùîþéüáëò»µãã»óð±øòªµäáé»îðô¡£îòãçôùò²²»äüõâñù£º*/
string str;
....
if(str = console.readline()) {
console.writeline("your comments are: {0}",str);
....
/* ¶ø±øð룺*/
using system;
class booltest
{
static void main() {
string str = console.readline();//ò²¿éòô£ºstring str;
if(str == "") // if((str = console.readline()) == "")
console.writeline("i can't read your comments. please tell me something! o.k.?");
else
console.writeline("your comments are: {0}",str);
}
}
/*
îò³­áëò»õåô¤¶¨òåààðíµä¼ò±í¹©´ó¼ò²î¿¼¡£

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 val1 = 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;

äãò²¿éòô×ô¶¨òå×ô¼ºµäô¤¶¨òåààðí£¬¿éòôõâñù£º*/
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();
}
}
/*
õâò»½úóðµã³áãæ¡££º£¨
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 纳雍县| 乌海市| 北辰区| 始兴县| 新泰市| 木兰县| 马山县| 东乌珠穆沁旗| 兴业县| 布尔津县| 湖北省| 通山县| 翁牛特旗| 英吉沙县| 孟津县| 博白县| 濮阳县| 宕昌县| 莱芜市| 安顺市| 安国市| 汾西县| 泉州市| 黑河市| 南岸区| 荃湾区| 河源市| 福建省| 通榆县| 通河县| 皋兰县| 长武县| 塔城市| 扬中市| 宁武县| 马尔康县| 泽州县| 三明市| 平凉市| 勐海县| 镇巴县|