What are the pros and cons for passing by value and by reference in C#?
Below is an example code that I am using to try to understand this side of C# better:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Diagnostics;
namespace Clock
{
public partial class Clock : System.Web.UI.Page
{
int timeZoneOffSet = 0;
protected void Page_Load(object sender, EventArgs e)
{
int refTest = 1;
int refValue = 2;
Debug.WriteLine(" --------- Start by Reference ----------------");
Debug.WriteLine("before ref: " + refTest.ToString());
changeRef(ref refTest);
Debug.WriteLine("after ref: " + refTest.ToString());
Debug.WriteLine(" --------- End ...
Go to the complete details ...