public static ReactionItem Parse(ReadOnlySpan <char> str) { var idx = str.IndexOf(' '); var quantity = long.Parse(str.Slice(0, idx)); var name = new string(str.Slice(idx + 1)); var chemical = Chemical.Create(name); return(new ReactionItem(chemical, quantity)); }
public static Chemical Create(string name) { if (_byName.ContainsKey(name)) { return(_byName[name]); } else { return(_byName[name] = new Chemical(name)); } }
public ReactionItem(Chemical chemical, long quantity) { Chemical = chemical; Quantity = quantity; }
internal ReactionItem this[Chemical chem] { get => _chems[chem.Id];