Structs can contain functions. Variables in Struct does not require to be defined as Static for global access for functions within Struct.
namespace NS1
{
class Program
{
struct Counties
{
//struct function doesnt require static keyword
public string countyName;
public string stateName;
public string mergedName()
{
return countyName + " is a county of " + stateName; //OK: accessible
}
}
static void Main(string [] args)
{
Counties st_county_1 = new Counties();
st_county_1.countyName = "dakota";
st_county_1.stateName = "nebraska";
Console.WriteLine(st_county_1.mergedName());
}
}
}