Properties Kullanımı

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

namespace propertiesKullanımı
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
class matematikHesabi
{

int i, sayi, faktoriyel;
public int deger
{
get
{
faktoriyel  =  1;
for (i = 1; i <= sayi;i++ )
{
faktoriyel  =  faktoriyel  *  i;
}
return faktoriyel;
}
set
{
sayi  =  value;
}
}

}
private void button1_Click(object sender, EventArgs e)
{
matematikHesabi yenimatematikHesabi = new matematikHesabi();
try
{
yenimatematikHesabi.deger = Convert.ToInt32(txtSayi.Text);
txtSonuc.Text = yenimatematikHesabi.deger.ToString();
}
catch
{
MessageBox.Show(“Lütfen sayı giriniz.”,”Uyarı”, MessageBoxButtons.OK,MessageBoxIcon.Warning);
}
}
}
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s