My question is simple: if a property is declared as private - how to call it?
In java we use getter&setter in which variable is private but in C# property is public; if I make it private, then in main class, it can't be called.
This is my code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace staticProperty
{
class Class1
{
private string name
{
get { return name; }
set { name = value; }
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace staticProperty
{
class Program
{
static void Main(string[] args)
{
Class1 c1 = new Class1();
c1.????
}
}
}
