Skip to content

Instantly share code, notes, and snippets.

@losch
Last active September 28, 2022 09:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save losch/d2a39ff3f88ee19b07e8d7f54979b354 to your computer and use it in GitHub Desktop.
Save losch/d2a39ff3f88ee19b07e8d7f54979b354 to your computer and use it in GitHub Desktop.
C-risuaitaus
using System;
using System.Collections.Generic;
class Breakfast {
private Dictionary<string, string> _dict;
public string Ham => _dict["ham"];
public string Bacon => _dict["bacon"];
public string Broccoli => _dict["broccoli"];
public Breakfast(Dictionary<string, string> dict) {
_dict = dict;
}
}
public class Program
{
public static void Main()
{
var breakfastDict = new Dictionary<string, string> {
{"ham", "No"},
{"bacon", "No"},
{"broccoli", "Yes"}
};
var breakfast = new Breakfast(breakfastDict);
Console.WriteLine($"breakfast: {breakfast.Ham}"); // "No"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment