Answers for "get set c#"

C#
6

get set c#

private string name;
public string Name
{
    get
    {
        return this.name;
    }
    set
    {
        this.name = value;
    }
}
Posted by: Guest on June-15-2020
2

c# get set

public class Employ
{
    public string Name { get; set; }
}
Posted by: Guest on January-08-2021
4

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
Posted by: Guest on March-31-2020
0

c# get set

public class Genre
{
    public string Name { get; set; }
}
Posted by: Guest on May-24-2021

C# Answers by Framework

Browse Popular Code Answers by Language