public CharLetter GetLetter(char c) { if (list.ContainsKey(c)) { return(list[c]); } var unUsedletter = new CharLetter(c); list.Add(c, unUsedletter); return(unUsedletter); }
public CharLetter GetLetter(char c) { if (_list.ContainsKey(c)) { return(_list[c]); //keyがあればvalueを返す } var unUsedletter = new CharLetter(c); //なければ生成する _list.Add(c, unUsedletter); return(unUsedletter); }
// Use this for initialization void Start() { var document = "iamaman"; var chars = document.ToCharArray(); var letterFactory = new LetterFactory(); foreach (var c in chars) { CharLetter charletter = letterFactory.GetLetter(c); ShowCharLetter(charletter); } }
void Start() { var document = "iamaman"; var chars = document.ToCharArray(); var letterFactory = LetterFactory.GetInstance(); foreach (var c in chars) { CharLetter charLetter = letterFactory.GetLetter(c); charLetter.ShowCharLetter(); } }
private void ShowCharLetter(CharLetter letter) { Debug.Log(letter.Singleletter); }