Answer the question
In order to leave comments, you need to log in
How to display Dictionary values?
There is a dictionary with added values
static Dictionary<(int, bool), string> Status = new Dictionary<(int, bool), string>();
static Generator()
{
Status.Add((1, false), "IsOnlyNumbers");
Status.Add((2, false), "IsOnlyAlphabetLower");
Status.Add((3, false), "IsOnlyAlphabetUpper");
Status.Add((4, false), "IsOnlySymbols");
}
foreach (var outer in Status.Keys)
{
foreach (var inner in Status.Values)
{
if (outer.Item2 == false)
{
Console.Write($"{outer.Item1} - {inner}: ");
Console.ForegroundColor = ConsoleColor.Red;
Console.Write($"{outer.Item2}\n");
Console.ResetColor();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
namespace Lab_Generator
{
class Program
{
static void Main(string[] args)
{
Generator.GetInfoTypes();
Generator.SetTypePassword();
Console.ReadLine();
}
}
class Generator
{
static Dictionary<(int, bool), string> Status = new Dictionary<(int, bool), string>();
static Generator()
{
Status.Add((1, false), "IsOnlyNumbers");
Status.Add((2, false), "IsOnlyAlphabetLower");
Status.Add((3, false), "IsOnlyAlphabetUpper");
Status.Add((4, false), "IsOnlySymbols");
}
public static void GetInfoTypes()
{
foreach (var outer in Status.Keys)
{
foreach (var inner in Status.Values)
{
if (outer.Item2 == false)
{
Console.Write($"{outer.Item1} - {inner}: ");
Console.ForegroundColor = ConsoleColor.Red;
Console.Write($"{outer.Item2}\n");
Console.ResetColor();
}
}
}
}
public static void SetTypePassword()
{
}
}
}
Answer the question
In order to leave comments, you need to log in
foreach (var stat in Status)
{
if (stat.Key.Item2 == false)
{
Console.Write($"{stat.Key.Item1} - {stat.Value}: ");
...
...
}
}
In general, it's easy to track down if you debug it.)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question