三叶草 发表于 2021-12-17 23:11:17

asp.net代码练习 work087

animal.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace work087
{
    public class Animal
    {
      public string color;//颜色
      public bool haveFeather; //羽毛
      public int age; //岁数
    }
}webform1.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace work087
{
    public partial class WebForm1 : System.Web.UI.Page
    {
      protected void Page_Load(object sender, EventArgs e)
      {
            work087.Animal bird = new Animal();
            bird.color = "颜色";
            bird.haveFeather = true;
            bird.age = 5;

            //无报错,即为ok

      }
    }
}

https://blog.51cto.com/u_15356972/3775756
页: [1]
查看完整版本: asp.net代码练习 work087