this program is running but how can i make this in two class by using get set?
using System;
class Program
{
static void Main()
{
DateTime now = DateTime.Now;
Console.WriteLine(now.ToShortDateString());
}
}
this program is running but how can i make this in two class by using get set?
using System;
class Program
{
static void Main()
{
DateTime now = DateTime.Now;
Console.WriteLine(now.ToShortDateString());
}
}
I think you are refering to property accessors.
public class myclass
{
// auto implemented. i.e no backing field
public string mystring {get;set;}
//or
// backing field and seperate get set accessors
private string _astring = string.empty;
public string astring{
get{ return _astring;}
set{ _astring = value;}
}
}
vote if it helps ya... ;-)
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.