public class Person
{
public string Name { get; set; }
public int Age { get; set; }
}
不是POCO的例子:
public class PersonComponent : System.ComponentModel.Component
{
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string Name { get; set; }
public int Age { get; set; }
}
class Fruit
{
public Fruit() { }
public Fruit(string name, double weight, int quantity)
{
Name = name;
Weight = weight;
Quantity = quantity;
}
public string Name { get; set; }
public double Weight { get; set; }
public int Quantity { get; set; }
public override string ToString()
{
return $"{Name.ToUpper()} ({Weight}oz): {Quantity}";
}
}