c# - Visual Studio 2012 not recognising nullable type -


i have 2 nullable datetimes, subtracting them result in nullable timespan. want call .value on this.

however, autocompletion drop-down list thinks type inside brackets normal timespan. .value not in list, , when use of suggestions, doesn't compile. compile when manually type .value.

the same issue occurs if 1 of datetimes nullable. occurs if add timespan? datetime? resulting in datetime?. intellisense thinks datetime.

is problem visual studio's intellisense? @ update 3, not have resharper. same issue on computer.

edit: clear, asking question why intellisense suggesting wrong type. know write make code compile.

agreed, gets wrong , doesn't correctly infer result of subtraction nullable<timespan>, infers timespan. can whack on head writing instead:

var span = date1 - date2; span. 

now does correctly infer type of span variable, you'll see hasvalue in auto-completion window. otherwise isn't slower @ @ runtime reasonable workaround.

nothing or can original oops, can file feedback report @ connect.microsoft.com. post link can vote it.


Comments