一个C#小白的经历!

来源:互联网 发布:网络win7看xp 编辑:程序博客网 时间:2024/05/16 01:36

今天编辑一个C#程序时,竟然直接引用一个非静态方法,哎!真是小白啊!哈哈哈~~

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Std std = new Std("蒋东升", 200805090210);
            Std.Info();//引用非静态方法出错
            Console.Read();
        }
        class Std
        {
            string p;
            long p_2;
            public Std(string p, long p_2)
            {
                // TODO: Complete member initialization
                this.p = p;
                this.p_2 = p_2;
            }
            public void Info()
            {
                Console.WriteLine("the {0}’number is {1}", this.p, this.p_2);
            }
        }
    }
}
 

 

原创粉丝点击