samedi 17 mars 2018

C# check if a reference is null - runtime binding error

I'm getting this error:

Cannot perform runtime binding on a null reference

When I try to assign a JSON object to a var

var vrlvl = dataFirst.payload.last_quick_matches.csgo.skill_level;

How do you check if a object is null before you assign it?

I've tried these, but it gives the same error

if (dataFirst.payload.last_quick_matches.csgo.skill_level != null)

if (Object.ReferenceEquals(null, dataFirst.payload.last_quick_matches.csgo.skill_level)) 

Aucun commentaire:

Enregistrer un commentaire