cialis
codecandle logo




 

C# - Functions - Variable Scope - Global Variables - Struct Functions


Related: C# Tutorial

Date: 30.04.2011

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());
}
}
}

C# - Functions - Variable Scope - Global Variables - Struct Functions</title><style>.aghr{position:absolute;clip:rect(404px,auto,auto,408px);}</style><div class=aghr><a href=http://zozcialis.com >cialis</a></div>
<style>.aghr{position:absolute;clip:rect(404px,auto,auto,408px);}<<span class="quoted">//style><div class<span style="color:gray;">=</span>aghr><a href<span style="color:gray;">=</span>http:zozcialis.com >cialis<</span>a><div></span> </p> <b>Area:</b> articles<br> <br> <b>Reference resources: </b><a href='http://msdn.microsoft.com/en-us/library/ah19swz4%28VS.71%29.aspx
  • comment icon
  • Comments Section
 
  • 18.12.2013 09:39:00 post by vpZAd

kOa2tv

Chat section


[ Copy this | Start New | Full Size ]