Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# trygetvalue sample

class Program
{
    static void Main()
    {
        var ids = new Dictionary<string, bool>() { { "X1", true } };
        // We can specify the "out" type by argument.
        if (ids.TryGetValue("X1", out bool result))
        {
            Console.WriteLine($"VALUE: {result}");
        }
    }
}
 
PREVIOUS NEXT
Tagged: #trygetvalue #sample
ADD COMMENT
Topic
Name
5+2 =