build errors in my function - C#