C# How to reduce repeat code?
<p>I've largely self taught myself C# code, I took a class in college that didnt help much...sure learned how to follow a book. So i've created tools here and there learning by example online. Stackoverflow is my favorite site for that, usually the community is helpful...</p>

<p>Anyway my question is this, im creating a WPF program that does multiple calculations on a number of decimals, the I've been getting by reusing the same code calculation over an over again, it works fine but I know there is a simpler way of doing it with much, much fewer lines. I seem to be missing that knowledge.</p>

<p>here is an example of how i would do things.</p>

<pre><code>int int1 = 4;
int int2 = 2;
int int3 = 6;
int int4 = 8;
int calc1 = 0;
int calc2 = 0;
int calc3 = 0;

calc = int1 * int4
calc2 = int1 * int2
calc3 = int3 * int3

if (calc &gt;= calc3)
{
do something;
}
else
{
calc = 33
}

if (calc2 &gt;= calc3)
{
do something;
}
else
{
calc2 = 33
}

if (calc3 &gt;= calc2)
{
do something;
}
else
{
calc3 = 33
}

if (calc3 &gt;= calc)
{
do something;
}
else
{
calc2 = 33
}
</code></pre>

<p>I hope that is clear enough.. I can repeat the code but I am just unsure how to use C# better, I know it has built in ways of reducing the repeating code, just dont know how to find them.</p>

<p>Any help or examples are appreciated.</p>
