Казалось бы от порядка объявления филдов ничего серьёзного не зависит... но вот пример "на
основе событий из жизни"
class Program {
readonly static Program _instance = new Program();
readonly static List
_instances = new List
public Program
(
Read more... )
Comments 2
(The comment has been removed)
static Side() {
Left = new Side();
Right = new Side();
Left.OtherSide = Right;
Right.OtherSide = Left;
}
private Side() {
}
целиком:
class Side {
public readonly static Side Left;
public readonly static Side Right;
static Side() {
Left = new Side();
Right = new Side();
Left.OtherSide = Right;
Right.OtherSide = Left;
}
private Side() {
}
public Side(Side otherSide) {
if (otherSide == null) throw new ArgumentNullException();
OtherSide = otherSide;
}
public Side OtherSide {get; private set;}
}
Reply
Reply
Leave a comment