visual studio 2008 - C# NET 3.5 : Property or indexer cannot be assigned to “--” it is read only -


i have readonly property:

public collectionview view { get; } 

and trying initialize class constructor:

public myclass() {    this.view = ...... } 

but error described in title appearing. using net 3.5 on visual studio 2008. remember in later versions of .net , visual studio readonly property initialized/assigned constructor. not possible in .net 3.5? if not, how can in .net 3.5? mean, want readonly property , assigned once in constructor.

in c# 3.0 didn't add special handling read-only autoproperties must old way:

public class myclass {     private readonly collectionview _view;     public collectionview view { { return _view; } }      public myclass() {         this._view = ...;     } } 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -