Spacing around "as" and "is" operators

Jun 17, 2011 at 9:09 PM

Hi,

AFAIK there is no rule to check proper spacing around "as" and "is" operators. Code like below could report some StyleCop warning for missing spaces before these operators:

            bool boolVar = (this.SomeReallyObscuredMethod(42, "foo"))is IConvertible;
            IConvertible convertible = (this.SomeReallyObscuredMethod(42, "foo"))as IConvertible;

I think this could be nice addition to existing spacing rules. What do you think?

            boolVar = (this.SomeReallyObscuredMethod(42, "foo"))is bool// BUGBUG
            object oo = (this.SomeReallyObscuredMethod(42, "foo"))as object// BUGBUG
Coordinator
Jun 19, 2011 at 1:59 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.