Force function to return value and make compile error C#
You could convert this to a property instead of a method:
public string myString
{
get
{
return "Blah";
}
}
Then you can't compile if you simply call the property:
myString.myString; //Results in "Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement" Error