As a programmer who don't have a good idea about the .NET pipeline, I was wondering if using ref strings as parameters are good for performance in C#?
Let's say I have a method like this:
public int FindSomething(string text)
{
// Finds a char in the text and returns its index
}
When I use this method, the compiler creates a copy of the text for the method, right?
But if I use the ref
keyword:
public int FindSomething(ref string text)
{
// Finds a char in the text and returns its index
}
.. the compiler should only send the text's pointer address...
So is it good for performance using ref
like this?