public CoffeeFlavor GetCoffeeFlavor(string flavorName) { CoffeeFlavor flavor; if (this._flavors.TryGetValue(flavorName, out flavor)) { return flavor; } flavor = new CoffeeFlavor(flavorName); this._flavors.Add(flavorName, flavor); return flavor; }
public CoffeeFlavor GetCoffeeFlavor(string flavorName) { if (!flavors.TryGetValue(flavorName, out CoffeeFlavor flavor)) { flavor = new CoffeeFlavor(flavorName); flavors.Add(flavorName, flavor); } return(flavor); }
public CoffeeFlavor GetCoffeeFlavor(string flavorName) { CoffeeFlavor flavor; if (this._flavors.TryGetValue(flavorName, out flavor)) { return(flavor); } flavor = new CoffeeFlavor(flavorName); this._flavors.Add(flavorName, flavor); return(flavor); }