/// <summary>
        /// Reverses the words.
        /// </summary>
        /// <param name="words">The source string.</param>
        /// <returns>The source string where words are reversed.</returns>
        public string ReverseWords(string words)
        {
            var properties = new Dictionary <string, string> {
                { "Argument 's'", $"'{words ?? "null"}'" }
            };

            Telemetry.TrackEvent("ReverseWords", properties);

            string result = string.Empty;

            try
            {
                result = new StringReverseService().ReverseWords(words);
            }
            catch (ArgumentNullException)
            {
                // The ArgumentNullException is expected, therefore re-throw it further.
                throw;
            }
            catch (Exception exception)
            {
                Telemetry.TrackException(exception);
            }

            return(result);
        }
Beispiel #2
0
        public string GetReverseWords(string sentence)
        {
            var properties = new Dictionary <string, string> {
                { "Argument 's'", string.Format("'{0}'", sentence == null ? "null" : sentence) }
            };

            telemetry.TrackEvent("ReverseWords", properties);

            var result = new StringReverseService().ReverseWords(sentence);

            return(result);
        }