C # Basics

Source: Internet
Author: User

Red for keywords, blue for syntax, purple for attention.

The first C # console application:

(Open vs, select "Console Application" to automatically generate C # programming infrastructure)

1 usingSystem;2 usingSystem.Collections.Generic;3 usingSystem.Linq;4 usingSystem.Text;5 6 namespaceHelloWorld (space name)7 {8 classProgram (class name)9 {Ten Static voidMain (string[] args) One { A //"Hello world!" is displayed to the user . -Console.WriteLine ("Hello world!");//this is handwritten. - } the } -}
The first C # program

Annotations:
using: Importing namespaces
  similar to : import (Java)
#include (C language)
namespace: For declaring namespaces (defining and creating your own namespaces)
  similar to : Package (Java)
class: Declaring classes
Mian Method : Program entry

Variables and constants: (Naming rules)

Variable:

  syntax: data type variable name;

1. In C #, variables are only declared and initialized before they can be used
2. Variable names are case-sensitive in C #

Constant:

  Syntax: Const data type constant name;(usually the constant name is capitalized)

C # Basics

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.