get set c#
private string name;
public string Name
{
get
{
return this.name;
}
set
{
this.name = value;
}
}
get set c#
private string name;
public string Name
{
get
{
return this.name;
}
set
{
this.name = value;
}
}
c# get set
public class Employ
{
public string Name { get; set; }
}
c# using get set methods
using System;
public class SaleItem
{
public string Name
{ get; set; }
public decimal Price
{ get; set; }
}
class Program
{
static void Main(string[] args)
{
var item = new SaleItem{ Name = "Shoes", Price = 19.95m };
Console.WriteLine($"{item.Name}: sells for {item.Price:C2}");
}
}
// The example displays output like the following:
// Shoes: sells for $19.95
c# get set
public class Genre
{
public string Name { get; set; }
}
get setter c# model
Person person = new Person();
person.Name = "Joe"; // the set accessor is invoked here
System.Console.Write(person.Name); // the get accessor is invoked here
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us