Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #r "$NuGet\System.Net.Http\4.3.3\lib\net46\System.Net.Http.dll"
- #r "$NuGet\System.Security.Cryptography.Algorithms\4.3.0\lib\net46\System.Security.Cryptography.Algorithms.dll"
- #r "$NuGet\System.Security.Cryptography.Encoding\4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll"
- #r "$NuGet\System.Security.Cryptography.Primitives\4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll"
- #r "$NuGet\System.Security.Cryptography.X509Certificates\4.3.0\lib\net46\System.Security.Cryptography.X509Certificates.dll"
- var dict = new Dictionary<string, IEnumerable<string>>
- {
- ["token"] = new List<string> { "abc" }
- };
- if (dict?.TryGetValue("token", out var values) == true)
- {
- Console.WriteLine(values.First());
- }
- // Produces unassigned local variable error, scoping issue?
- {
- var errDict = new Dictionary<string, IEnumerable<string>>
- {
- ["token"] = new List<string> { "abc" }
- };
- if (errDict?.TryGetValue("token", out var tokens) == true)
- {
- Console.WriteLine(tokens.First());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment