Quantcast
Channel: YouTrackReSharper (RSRP) - Bug and Issue Tracker
Viewing all articles
Browse latest Browse all 106942

RSRP-287424: Incorrect message: "The as operator must be used with a reference type"

$
0
0
Reporter Peter Hoogenboom (phoogenb) Peter Hoogenboom (phoogenb)
Created Dec 28, 2011 1:55:04 AM
Updated Dec 28, 2011 1:55:04 AM
Priority Normal
Type Unspecified
Fix versions No Fix versions
State Submitted
Assignee Unassigned
Subsystem No subsystem
Affected versions No Affected versions
Fixed in build No Fixed in build
Beginning with C# 2.0, the as operator also supports nullable types (which are not reference types). ReSharper flags the line

var n = 255 as byte;

with

The as operator must be used with a reference type ('byte' is a value type)

but the corresponding compiler error in C# 4.0 is

The as operator must be used with a reference type or nullable type ('byte' is a non-nullable value type)

Viewing all articles
Browse latest Browse all 106942

Trending Articles