;<\/span><\/pre>\n\u5728\u8fd9\u91cc\uff0cdata_type \u5fc5\u987b\u662f\u4e00\u4e2a\u6709\u6548\u7684 C# \u6570\u636e\u7c7b\u578b\uff0c\u53ef\u4ee5\u662f char\u3001int\u3001float\u3001double \u6216\u5176\u4ed6\u7528\u6237\u81ea\u5b9a\u4e49\u7684\u6570\u636e\u7c7b\u578b\u3002variable_list \u53ef\u4ee5\u7531\u4e00\u4e2a\u6216\u591a\u4e2a\u7528\u9017\u53f7\u5206\u9694\u7684\u6807\u8bc6\u7b26\u540d\u79f0\u7ec4\u6210\u3002<\/p>\n
\u4e00\u4e9b\u6709\u6548\u7684\u53d8\u91cf\u5b9a\u4e49\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n
int i, j, k;\r\nchar c, ch;\r\nfloat f, salary;\r\ndouble d;<\/pre>\n\u60a8\u53ef\u4ee5\u5728\u53d8\u91cf\u5b9a\u4e49\u65f6\u8fdb\u884c\u521d\u59cb\u5316\uff1a<\/p>\n
int i = 100;<\/pre>\nC# \u4e2d\u7684\u53d8\u91cf\u521d\u59cb\u5316<\/strong><\/div>\n\u53d8\u91cf\u901a\u8fc7\u5728\u7b49\u53f7\u540e\u8ddf\u4e00\u4e2a\u5e38\u91cf\u8868\u8fbe\u5f0f\u8fdb\u884c\u521d\u59cb\u5316\uff08\u8d4b\u503c\uff09\u3002\u521d\u59cb\u5316\u7684\u4e00\u822c\u5f62\u5f0f\u4e3a\uff1a<\/p>\n
variable_name = value;<\/pre>\n\u53d8\u91cf\u53ef\u4ee5\u5728\u58f0\u660e\u65f6\u88ab\u521d\u59cb\u5316\uff08\u6307\u5b9a\u4e00\u4e2a\u521d\u59cb\u503c\uff09\u3002\u521d\u59cb\u5316\u7531\u4e00\u4e2a\u7b49\u53f7\u540e\u8ddf\u4e00\u4e2a\u5e38\u91cf\u8868\u8fbe\u5f0f\u7ec4\u6210\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n
<data_type><\/span> <\/span><variable_name><\/span> = value;<\/span><\/pre>\n\u4e00\u4e9b\u5b9e\u4f8b\uff1a<\/p>\n
int d = 3, f = 5; \/* \u521d\u59cb\u5316 d \u548c f. *\/\r\nbyte z = 22; \/* \u521d\u59cb\u5316 z. *\/\r\ndouble pi = 3.14159; \/* \u58f0\u660e pi \u7684\u8fd1\u4f3c\u503c *\/\r\nchar x = 'x'; \/* \u53d8\u91cf x \u7684\u503c\u4e3a 'x' *\/<\/pre>\n\u6b63\u786e\u5730\u521d\u59cb\u5316\u53d8\u91cf\u662f\u4e00\u4e2a\u826f\u597d\u7684\u7f16\u7a0b\u4e60\u60ef\uff0c\u5426\u5219\u6709\u65f6\u7a0b\u5e8f\u4f1a\u4ea7\u751f\u610f\u60f3\u4e0d\u5230\u7684\u7ed3\u679c\u3002<\/p>\n
\u8bf7\u770b\u4e0b\u9762\u7684\u5b9e\u4f8b\uff0c\u4f7f\u7528\u4e86\u5404\u79cd\u7c7b\u578b\u7684\u53d8\u91cf\uff1a<\/p>\n
\u5b9e\u4f8b<\/strong><\/p>\nnamespace<\/span> VariableDefinition\r\n{\r\n class<\/span> Program\r\n {\r\n static<\/span> void<\/span> Main(<\/span>string<\/span>[<\/span>]<\/span> args)\r\n {\r\n short<\/span> a;\r\n int<\/span> b ;\r\n double<\/span> c;\r\n \/* \u5b9e\u9645\u521d\u59cb\u5316 *\/\r\n a =<\/span> 10<\/span>;\r\n b =<\/span> 20<\/span>;\r\n c =<\/span> a +<\/span> b;\r\n Console.<\/span>WriteLine<\/span>(<\/span>\"a = {0}, b = {1}, c = {2}\"<\/span>, a, b, c)<\/span>;\r\n Console.<\/span>ReadLine<\/span>(<\/span>)<\/span>;\r\n }\r\n }\r\n}<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/pre>\n\u5f53\u4e0a\u9762\u7684\u4ee3\u7801\u88ab\u7f16\u8bd1\u548c\u6267\u884c\u65f6\uff0c\u5b83\u4f1a\u4ea7\u751f\u4e0b\u5217\u7ed3\u679c\uff1a<\/p>\n
a = 10, b = 20, c = 30<\/pre>\n\u63a5\u53d7\u6765\u81ea\u7528\u6237\u7684\u503c<\/strong><\/div>\nSystem \u547d\u540d\u7a7a\u95f4\u4e2d\u7684 Console \u7c7b\u63d0\u4f9b\u4e86\u4e00\u4e2a\u51fd\u6570 ReadLine()\uff0c\u7528\u4e8e\u63a5\u6536\u6765\u81ea\u7528\u6237\u7684\u8f93\u5165\uff0c\u5e76\u628a\u5b83\u5b58\u50a8\u5230\u4e00\u4e2a\u53d8\u91cf\u4e2d\u3002
\n\u4f8b\u5982\uff1a<\/p>\n
int num;\r\nnum = Convert.ToInt32(Console.ReadLine());<\/pre>\n\u51fd\u6570 Convert.ToInt32() \u628a\u7528\u6237\u8f93\u5165\u7684\u6570\u636e\u8f6c\u6362\u4e3a int \u6570\u636e\u7c7b\u578b\uff0c\u56e0\u4e3a Console.ReadLine() \u53ea\u63a5\u53d7\u5b57\u7b26\u4e32\u683c\u5f0f\u7684\u6570\u636e\u3002<\/p>\n
C# \u4e2d\u7684 Lvalues \u548c Rvalues<\/strong><\/div>\nC# \u4e2d\u7684\u4e24\u79cd\u8868\u8fbe\u5f0f\uff1a<\/p>\n
\n- lvalue\uff1alvalue \u8868\u8fbe\u5f0f\u53ef\u4ee5\u51fa\u73b0\u5728\u8d4b\u503c\u8bed\u53e5\u7684\u5de6\u8fb9\u6216\u53f3\u8fb9\u3002<\/li>\n
- rvalue\uff1arvalue \u8868\u8fbe\u5f0f\u53ef\u4ee5\u51fa\u73b0\u5728\u8d4b\u503c\u8bed\u53e5\u7684\u53f3\u8fb9\uff0c\u4e0d\u80fd\u51fa\u73b0\u5728\u8d4b\u503c\u8bed\u53e5\u7684\u5de6\u8fb9\u3002<\/li>\n<\/ol>\n
\u53d8\u91cf\u662f lvalue \u7684\uff0c\u6240\u4ee5\u53ef\u4ee5\u51fa\u73b0\u5728\u8d4b\u503c\u8bed\u53e5\u7684\u5de6\u8fb9\u3002\u6570\u503c\u662f rvalue \u7684\uff0c\u56e0\u6b64\u4e0d\u80fd\u88ab\u8d4b\u503c\uff0c\u4e0d\u80fd\u51fa\u73b0\u5728\u8d4b\u503c\u8bed\u53e5\u7684\u5de6\u8fb9\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u6709\u6548\u7684\u8bed\u53e5\uff1a<\/p>\n
int g = 20;<\/pre>\n\u4e0b\u9762\u662f\u4e00\u4e2a\u65e0\u6548\u7684\u8bed\u53e5\uff0c\u4f1a\u4ea7\u751f\u7f16\u8bd1\u65f6\u9519\u8bef\uff1a<\/p>\n
10 = 20;<\/pre>\n","protected":false},"excerpt":{"rendered":"\u6211\u4eec\u5df2\u7ecf\u8ba8\u8bba\u4e86\u5404\u79cd\u6570\u636e\u7c7b\u578b\u3002C# \u4e2d\u63d0\u4f9b\u7684\u57fa\u672c\u7684\u503c\u7c7b\u578b\u5927\u81f4\u53ef\u4ee5\u5206\u4e3a\u4ee5\u4e0b\u51e0\u7c7b\uff1a \u7c7b\u578b \u4e3e\u4f8b \u6574\u6570\u7c7b\u578b sbyte […]<\/p>\n","protected":false},"author":321,"featured_media":234085,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-234082","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/234082","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/321"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=234082"}],"version-history":[{"count":4,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/234082\/revisions"}],"predecessor-version":[{"id":234149,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/234082\/revisions\/234149"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/234085"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=234082"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=234082"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=234082"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}