コード例 #1
0
 public int CountWords(WordCount wc)
 {
     int count;
       var wordList = new List<string>();
       wordList = wc.Input.Split().ToList();
       count = wordList.Count();
       return count;
 }
コード例 #2
0
        public ActionResult WordCounter(WordCountTool model)
        {
            if (ModelState.IsValid)
            {
                var wc = new WordCount();
                wc.Input = model.UserInput;
                var we = new WordEnumerator();
                model.Count = we.CountWords(wc);
                return View(model);

            }
            return View("WordCounter", model);
        }