zoukankan      html  css  js  c++  java
  • C#变量

    命名时不能出现%符号

     

    
    
     1 using System;
     2 using System.Collections.Generic;
     3 using System.Linq;
     4 using System.Text;
     5 using System.Threading.Tasks;
     6 
     7 namespace ConsoleApplication3
     8 {
     9     class Program
    10     {
    11         string str = "";//实例变量只有使用对象名进行调用
    12         static string str2 = "dsfv";//静态成员变量可以直接调用
    13         static void Main(string[] args)
    14         {
    15             Program p = new Program();//使用对象名才可以进行调用
    16             Console.WriteLine(p.str);
    17             Console.WriteLine(str2);
    18             int money = 300;
    19             int money2;
    20             money2 = 200;
    21             int money3, moner4;
    22             string title="dsfsgfdgd";
    23             string title1;
    24             title1 =title ;
    25             string s1, s2, s3;
    26             s1 = s2 = s3 = "";
    27             Console.WriteLine(title);
    28             Console.WriteLine(title1);
    29             Console.Read();
    30           
    31 
    32         }
    33         void showInfo()
    34         {
    35             string str3 = "";//str3为局部变量不能再class中调用
    36             Console.WriteLine(str3);
    37             Console.WriteLine(str);
    38         }
    39     }
    40 }

  • 相关阅读:
    取时间
    DEV控件属性
    Dev之barManager控件属性
    linq查询Contains
    绑定
    运算符转换方法组和int类型的操作数
    学习计划实践
    学习计划2
    foreacht学习
    Spring5源码分析(二) IOC 容器的初始化(五)
  • 原文地址:https://www.cnblogs.com/ZHANG576433951/p/11128901.html
Copyright © 2011-2022 走看看