C# return a variable as read only from get; set;

后端 未结 7 2164
不思量自难忘°
不思量自难忘° 2021-02-02 07:30

I swear I have seen an example of this but have been googling for a bit and can not find it.

I have a class that has a reference to an object and need to have a GET; met

7条回答
  •  孤独总比滥情好
    2021-02-02 07:59

    Your question reads like you're looking for:

    public PropertyName { get; private set; }
    

    But then, given the answers so far I'm not sure I'm interpreting your question correctly. Besides, who am I to question Jon Skeet? :)

提交回复
热议问题