I assume you mean this for the second
using System;
public class Test
{
private string x;
public string GetX()
{
return x;
}
}
In which case it is a method that returns a string
while your first example is a readonly
property
solved Difference between get{return x} and return x [duplicate]