zoukankan      html  css  js  c++  java
  • C#基础学习

    几个问题

    F11单步调试与F10逐步调试区别:单步调试会进入函数内部,逐步不会
    F9设置断点
    类相当于一个model,不能对model进行赋值操作。
    通过属性过滤调一些不需要的数据
    类中有字段,属性,方法

            public string name;
            public string ff
            {
                set { this.name = value; }
                get { return this.name; }
                //get { return this.name+"is a very good"; }
            }
            public int Speak()
            {
                Console.WriteLine("jingya is very good boy!");
                return 1;
            }
    

    int 是定义返回值类型,void设置为空

    people.we = "we";//静态字段直接可以引用,静态类下全是静态的,普通类下可以有静态的
    类默认为public,字段默认private
    继承:class man : people{}
    值类型:
    C# 中的局部变量之前,必须对其进行初始化。
    int myInt = new int();
    myInt = 0;
    Point p = new Point();
    引用类型 man m = new man();
    这样的是引用类型

    class Program
        {
            static void Main(string[] args)
            {
                people peo = new people();
                //peo.age = 30并不能设置类的name和hair
                man m = new man();
                peo.fl = 20;
                ///peo.age = 30
                m.gender = "ma";
                m.fl = 40;
                super.name = "ssss";
                people.we = "we";//静态字段直接可以引用
                Console.WriteLine(peo.fl);
                Console.WriteLine(m.gender);
                Console.WriteLine(m.fl);
                Console.WriteLine(peo.fl);//不是指向同一个地址
                Console.ReadKey();
            }
        }
        class people//默认public
        {
            public static string we;//静态字段
            private string hair;
            protected string name;      
            public float fl;
            int heigt;//默认private
    
        }
        class man : people
        {
            public string gender;
            public string ff
            {
                set { this.name = value; }
                get { return this.name; }
                //get { return this.name+"is a very good"; }
            }
        }
        public static class super//静态类
        {
            public static string name;
            public static int Speak()
            {
                Console.WriteLine("jingya is very good boy!");
                return 1;
            }
        }
    
  • 相关阅读:
    Excel中的日期时间计算,套路很全
    WPS表格 制作甘特图
    关于海康威视与Unity3d集成冲突问题解决
    海康威视(iOS集成)
    Objective-C
    Android中windowTranslucentStatus与windowTranslucentNavigation的一些设置(转)
    Could not symlink include/node/android-ifaddrs.h
    dyld`__abort_with_payload:
    about the libiconv.2.dylib
    Intent的作用和表现形式简单介绍
  • 原文地址:https://www.cnblogs.com/wuqingzangyue/p/5460187.html
Copyright © 2011-2022 走看看