csharp 4-25-WindowsFormsApp3 #pro_OBJ

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp 4-25-WindowsFormsApp3 #pro_OBJ相关的知识,希望对你有一定的参考价值。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp3
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Doll firstDoll = new Doll();
            firstDoll.Name = "花子";
            firstDoll.Age = 3;
            Doll secondDoll = new Doll();
            secondDoll.Name = "太郎";
            secondDoll.Age = firstDoll.Age * 2;
            Doll thirdDoll = new Doll();
            thirdDoll.Name = "次郎";
            thirdDoll.Age = secondDoll.Age - 2;
            thirdDoll.IntroduceYourself();
        }

        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {
            Doll fourthDoll = new Doll();
            fourthDoll.Age = 5;
            fourthDoll.IntroduceYourAge();
        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {
            Doll fifthDoll = new Doll();
            fifthDoll.Name = "三郎";
            fifthDoll.IntroduceYourName();
        }
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
    class Doll
    {
        public string Name;
        public int Age;

        public void IntroduceYourself()
        {
            MessageBox.Show("私の名前は"
                + Name + "です。私の年齢は"
                + Age + "才です。");
        }

        public void IntroduceYourName()
        {
            MessageBox.Show("私の名前は" + Name + "です。");
        }

        public void IntroduceYourAge()
        {
            MessageBox.Show("私の年齢は" + Age + "才です。");
        }
    }
}

以上是关于csharp 4-25-WindowsFormsApp3 #pro_OBJ的主要内容,如果未能解决你的问题,请参考以下文章

csharp 例如-CSHARP-GroupDocs.Conversion.Examples.CSharp渲染,RenderPSDImageAsPath.cs

csharp 实例-CSHARP-GroupDocs.Conversion.Examples.CSharp变频-ConvertTopresentationAsPath.cs

csharp 实例-CSHARP-GroupDocs.Conversion.Examples.CSharp变频-ConvertTopresentationAsPath.cs

csharp 实例-CSHARP-GroupDocs.Conversion.Examples.CSharp变频-ConvertTopresentationAsPath.cs

csharp 例如-CSHARP-GroupDocs.Search.Examples.CSharp索引,AddDocumentToIndex.cs

csharp 例如-CSHARP-GroupDocs.Search.Examples.CSharp索引,AddDocumentToIndexAsynchronously.cs