Created
November 13, 2019 00:17
-
-
Save jindeveloper/e5e1e2079cffd34190eec12cfbd34144 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace ExploreDictionaryListComparison | |
{ | |
public enum ServerConnection | |
{ | |
SERVER_1= 0, | |
SERVER_2 = 1 | |
} | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Dictionary<ServerConnection, List<Servers>> servers = new Dictionary<ServerConnection, List<Servers>> { }; | |
var enumKeys = (ServerConnection[])Enum.GetValues(typeof(ServerConnection)); | |
foreach (var item in enumKeys) | |
{ | |
if (!servers.Keys.Any( key => servers.ContainsKey(key))) | |
{ | |
servers.Add(ServerConnection.SERVER_1, | |
new List<Servers> { new Servers { Id = Guid.Parse("ccebda07-437a-4e8d-a2a6-c8d0c31138a3") }, new Servers { Id = Guid.NewGuid() } }); | |
} | |
else | |
{ | |
var values = servers.Values; | |
bool meron = values.ToList().Any(y => y.Any(x => x.Id.ToString().Contains("ccebda07-437a-4e8d-a2a6-c8d0c31138a3"))); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment