AWSSAML.SetAWSSAMLCredentials.AskUserForAwsSamlRole C# (CSharp) Method

AskUserForAwsSamlRole() private method

private AskUserForAwsSamlRole ( string awsSamlRoles ) : string
awsSamlRoles string
return string
        private string AskUserForAwsSamlRole(string[] awsSamlRoles)
        {
            Console.WriteLine("Please choose the role you would like to assume:");
            for (int i = 0; i < awsSamlRoles.Length; i++)
            {
                string[] awsSamlRole = awsSamlRoles[i].Split(',');
                Console.WriteLine(String.Format(" [{0}]: {1} ", i, awsSamlRole[1]));
            }

            Console.Write("Selection: ");

            ConsoleKeyInfo key;
            int index = 0;

            do
            {
                key = Console.ReadKey();
                index = int.Parse(key.KeyChar.ToString());
            } while (!Char.IsNumber(key.KeyChar) || index > awsSamlRoles.Length - 1);
            Console.WriteLine();

            return awsSamlRoles[index];
        }