FORM1
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
HappyBirthday HB;
HB = new HappyBirthday();
string returB;
HB.MyProperty = "glenn";
returB = HB.MyProperty;
MessageBox.Show(returB);
}
}
}
Class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WindowsFormsApplication1
{
class HappyBirthday
{
private string getMessage(string givenName)
{
return "happy Birthday" + givenName;
}
private string birthdayMessage;
public string MyProperty
{
get { return birthdayMessage; }
set { birthdayMessage = getMessage(value); }
}
}
}
Abonner på:
Legg inn kommentarer (Atom)
Ingen kommentarer:
Legg inn en kommentar