when used Dictionary How can I get the value if it non nullable value type

forme forme

when used Dictionary

How can I get the value if it non nullable value type this code

            Dictionary<string, object> DictionaryValues = new Dictionary<string, object>();
            RSAParameters publicKey = Storage.Read(_Path + @"\" + "Key.Public");
            DictionaryValues["publicKey"] = publicKey;


            RSAParameters publicKey2 = new RSAParameters();
            if (DictionaryValues.TryGetValue("publicKey", out object obj))
            {
                publicKey2 = obj as RSAParameters;
                
            }

I'm getting an error the as operator must be used with a reference type or nullable type RSAParameters is anon nullable

How can I get the value publicKey from inside the dictionary Please help and thank you everyone

enter image description here

Henk Holterman
//publicKey2 = obj as RSAParameters;
  publicKey2 = (RSAParameters)obj;

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How I can get return value based on argument type?

How can I get key's value from dictionary in Swift?

How do I get the value in a generic Dictionary?

How can I get the new value of HTML colorpicker when it changes?

How can I get the attribute type and its value

How should I use the nullable type if it has a value

How do I get the value of an dictionary for Django?

How can I replace "None" as a dictionary value with an empty dictionary?

How can I persist an array of a nullable value in Protobuf-Net?

Cannot call value of non-function type 'JSON', How can I return value from block in Swift

How can I get first value in a dictionary in django template?

How can I get the type of a value in boost::fusion::map?

How can I get value when submit form on the vue component?

How can I get a value from a thread to be used in parent thread?

How can I get value when click option in the select on vue?

How do i get a value in a dictionary of dictionarys when i dont care about the key of the outside value

How can I get the key value pair to create a dictionary from a nested dictionary?

How can I auto-increment the value in a dictionary when there is a difference?

How can I get the key of the object with a lowest attribute value for a Python dictionary with a string as key and a class object as value?

How can I return the value of a key based on a different value in a dictionary

How can I convert an empty string value to a nullable date value?

constructor called when instatiating a nullable value type

"Don't cast a nullable value to a non nullable type" in Map when converting JSON to object

How can I get next value from a python dictionary after matching the key value with some string

Why I can't return a generic nullable value type and nullable reference type?

How to get a nullable DateTime value?

golang how i can get value from []interface {} type

Dictionary with object - warning Converting null literal or possible null value to non-nullable type

How can I get value from dictionary object?