+4 votes
in .NET Core by (630 points)
retagged by

1 Answer

+1 vote
by (630 points)
  1. Lỗi data NULL “object reference not set to an object instance”

=> Khi viết code cần chú ý những đoạn code có thể null

Ví dụ:

Không nên

Nên (sử dụng C# 6)

int a = item.Number.Value;


 

int a = item.Number ?? 0;


 
Welcome to Qtsd Q&A, where you can ask questions and receive answers from other members of the community.
...