martes, 22 de mayo de 2018

System.InvalidOperationException: 'No se puede convertir un valor nulo en un tipo de valor.' C#


System.InvalidOperationException: 'No se puede convertir un valor nulo en un tipo de valor.'



Asigne un valor a un tipo que acepta valores NULL tal como lo haría para un tipo de valor normal, por ejemplo int? x = 100; o double? d = 14.108. A un tipo que acepta valores NULL también se le puede asignar el valor null: int? x = null.

Ejemplo

  public class Data
    {
        public int id { get; set; }
        public string name { get; set; }
        public string symbol { get; set; }
        public string website_slug { get; set; }
        public int? rank { get; set; }
        public double? circulating_supply { get; set; }
        public double? total_supply { get; set; }
        public double? max_supply { get; set; }
        public Quotes quotes { get; set; }
        public int last_updated { get; set; }
    }

No hay comentarios:

Publicar un comentario

Comenta cualquier duda o recomendatorio.