How To Work With Structure In C# Simple Tutorial With Source Code
//Structure//
public struct abc
{
public int a, b;
public void xyz(int x, int y)
{
x = a;
y = b;
}
}
public struct points
{
public int x, y;
public points(int ab, int bc)
{
x = ab;
y = bc;
}
}
public struct btdata
{
public int sal;
public int bonus;
}
public struct abc
{
public int a, b;
public void xyz(int x, int y)
{
x = a;
y = b;
}
}
public struct points
{
public int x, y;
public points(int ab, int bc)
{
x = ab;
y = bc;
}
}
public struct btdata
{
public int sal;
public int bonus;
}
private void Structure_Btn_Click(object sender, EventArgs e)
{ ////Structure
abc ab;
ab.a = 7;
ab.b = 8;
int c;
c = ab.a + ab.b;
label1.Text = c.ToString();
points st;
st.x = 5;
st.y = 10;
c = st.x * st.y;
label2.Text = c.ToString();
btdata data;
data.sal = 45000;
data.bonus = 10000;
c = data.sal + data.bonus;
label3.Text = c.ToString();
//----------------------//
}
No comments:
Post a Comment