c# passing classes through functions

hi, i would like to pass a class into a function. I was wondering if a class values were changed inside the function would affect the actual class because it has not created a new instant (i could be wrong). does any one know, or would have have to return the class.
Thanks

When passing classes you are passing by reference. Any changes will affect the original.

When passing primitives or structs you pass by value. Any changes will not affect the original.

You can pass class like below example.

    void Start()
	{
		Hello (new testClass);
	}

	void Hello(testClass tc)
	{
		//some code goes here
	}

	class testClass
	{
		public int dataValue;
		        
		public testClass()
		{

		}
	}
}

Or you can pass component as a argument also if class is using monobehaviour.