Top "Readonly" questions

Read-only is a generic concept that means "not writeable" - Please DO NOT USE THIS TAG.

c# readonly object

Is there any way to return a readonly instance of an object? public class Person { public String FirstName { get; set; } …

c# object readonly reference-type
Knockout attr binding with attributes like 'readonly' and 'disabled'

What's the suggested "best practice" way to use Knockout's "attr" data binding with standalone attributes like "readonly" and "disabled"? These …

html data-binding knockout.js readonly disabled-input
C# return a variable as read only from get; set;

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

c# properties readonly
Why is this field declared as private and also readonly?

In the following code: public class MovieRepository : IMovieRepository { private readonly IHtmlDownloader _downloader; public MovieRepository(IHtmlDownloader downloader) { _downloader = downloader; } public Movie …

c# .net interface readonly
Why does C# disallow readonly local variables?

Having a friendly debate with a co-worker about this. We have some thoughts about this, but wondering what the SO …

c# immutability language-design readonly
WPF Datagrid with some read-only rows

I have the need to show some of my WPF Datagrid rows as read only or not depending on a …

wpf datagrid wpftoolkit readonly
How do I set a readonly field in an initialize method that gets called from the constructor?

I'm sure I've seen somewhere that I can do the following by using an attribute above my Init() method, that …

c# constructor readonly
What is the C++ equivalent of C#'s readonly field modifier?

Locking down state is great. In C# you can ensure that a field doesn't change it's value/reference once the …

c++ field immutability readonly
Why isn't String.Empty a constant?

In .Net why is String.Empty read only instead of a constant? I'm just wondering if anyone knows what the …

.net string readonly constants