Beispiel #1
0
        public static String[] MyMethod(String[] names)
        {
            // setup the ASCII values array once, not per each name call!
            AsciiSymbols.GenerateAsciiValues();

            foreach (var name in names)
            {
                // call the method DisplaySumOfAsciiValues for each name!
                a = name;
                b = AsciiSymbols.DisplaySumOfAsciiValues(name);
                results[ctr++] = a + " " + b;
            }

            return(results);
        }
        public static NameAndNumberData[] MyMethod(String[] names)
        {
            // setup the ASCII values array once, not per each name call!
            AsciiSymbols.GenerateAsciiValues();

            foreach (var name in names)
            {
                NameAndNumberData dataRecord = new NameAndNumberData();

                // call the method DisplaySumOfAsciiValues for each name!
                dataRecord.name             = name;
                dataRecord.AsciiValueOfName = AsciiSymbols.DisplaySumOfAsciiValues(name);
                results[ctr++] = dataRecord;
            }

            return(results);
        }