My Code:
basketsub.Properties.ColorId = Convert.ToInt32(itemspliters[3] != null
? itemspliters[3].ToString()
: "0");
Error:
Object reference not set to an instance of an object!!!
Can you tell me what am I doing wrong? Thanks.
My Code:
basketsub.Properties.ColorId = Convert.ToInt32(itemspliters[3] != null
? itemspliters[3].ToString()
: "0");
Error:
Object reference not set to an instance of an object!!!
Can you tell me what am I doing wrong? Thanks.
You should also check itemspliters != null
basketsub.Properties.ColorId = Convert.ToInt32(itemspliters != null && itemspliters.Length >= 4 && itemspliters[3] != null
? itemspliters[3].ToString()
: "0");