Tech Blog

Why you can't pass property as out or ref parameter

By: Chris Dunn on Tue Sep 11, 2018 (3 min read)

Sometimes compiler or language rules seem arbitrary, but actually make much more sense if you know why they are in place.  It's never a bad idea to peak under the hood, from time to time to get some perspective. If you're writing a method or utilizing a method with a ref or out parameter, like TryParse, you'll soon realize that you can't pass in an object property as the out or ref parameter. You will meet with the following error "A property or indexer may not be passed as an out or ref paramet ...

Copyright 2019 Cidean, LLC. All rights reserved.

Proudly running Umbraco 7. This site is responsive with the help of Foundation 5.