1

I have an entity(EF) with property int? priority.

I want to work with the entity across my platform.

Dictionary<int, Task> tasks = new Dictionary<int,Task>();
tasks.Add(task.Priority, task);

in the second row, I want to get Priority out of task and fire it an int. but I get an error that int? is not int, which is true.

How to handle this situation

Thanks

CD..
  • 72,281
  • 25
  • 154
  • 163
SexyMF
  • 10,657
  • 33
  • 102
  • 206

1 Answers1

0

You can use the Value Property witch gets the value of the current Nullable value.

But be aware to the HasValue Property so you can provide a default value in case its false.

CD..
  • 72,281
  • 25
  • 154
  • 163