Although I have been studying C # For a while, I have learned from it because of the poor foundation. net framework cannot be used in depth. Now I will go back to the system and record some things in my blog. I will go back and look at it if I am idle and have nothing to do with it. I will deepen my grammar impressions, so experts will not have to look at it, it's all about basic things. It's just a note. Just like me, cainiao can come and take a look at the basics of their own syntax. It's not a good thing.
// Method with return value
// Call example:
// Int I = 2;
// Int result = Add (I );
// Console. WriteLine (result );
// Console. WriteLine (I );
// The output result is 3 and 2.
// The parameter is of the value type and the original value is not modified.
Public static int Add (int ToNumber)
{
Int sum = 0;
For (int I = 1; I <= ToNumber; I ++)
{
Sum + = I;
}
Return sum;
}
// Method without return value
// Call example:
// AddVoid (2 );
// The output result is 3.
Public static void AddVoid (int ToNumber)
{
Int sum = 0;
For (int I = 1; I <= ToNumber; I ++)
{
Sum + = I;
}
Console. WriteLine (sum );
}
// Reference type Method
// Call example
// Test obj = new Test ();
// AddObject (obj );
// Console. WriteLine (obj. Number );
// The output result is 3.
// Pass in the Number attribute of the obj object. The original attribute value is 1. After the object is passed in, its attribute is also modified.
// The reference type parameter is a data transfer address, not a value. The original values of all reference types are also modified.
Public static void AddObject (Test