Код: Выделить всё
public record Box(double Capacity);
- Тип записи Box.
- Свойство Емкость.
- Основной конструктор.
Параметр конструктора Емкость.< /li>
Код: Выделить всё
///
/// A container for items.
///
///
How much the Box can hold
public record Box(double Capacity);
Как обсуждалось в этом вопросе, я могу создавать независимые комментарии для свойства и параметра конструктора, явно объявляя свойство:< /p>
Код: Выделить всё
///
/// A container for items.
///
///
Specifies the size of the box
public record Box(double Capacity) {
///
/// Returns the size of the box.
///
public double Capacity { get; init; } = Capacity;
}
Код: Выделить всё
///
/// A container for items.
///
public record Box {
///
/// Returns the size of the box.
///
public double Capacity { get; init; }
///
/// Creates a new Box instance.
///
///
Specifies the size of the box
public Box(double Capacity) {
this.Capacity = Capacity;
}
}
Подробнее здесь: https://stackoverflow.com/questions/782 ... in-c-sharp
Мобильная версия