| bio | website | |
|---|---|---|
| location | ||
| age | ||
| visits | member for | 4 months |
| seen | Feb 6 at 17:05 | |
| stats | profile views | 0 |
|
Jan 29 |
awarded | Supporter |
|
Jan 29 |
comment |
Best Practices Returning Read-Only Object Note for other interested parties. When considering the property accessor: if you do just return IEnumerable<string> instead of List<string> by doing return _list (+implicit cast to IEnumerable) then this list can be cast back into List<string> and changed and the changes will propagate into the main object. You can do return new List<string>( _list ) (+subsequent implicit cast to IEnumerable) which will protect the internal list. More on this can be found here: stackoverflow.com/questions/4056013/… |
|
Jan 29 |
accepted | Best Practices Returning Read-Only Object |
|
Jan 29 |
comment |
Best Practices Returning Read-Only Object Thank you, I did not realize that IEnumerable<> is immutable. Your solution is very good, however the question was aimed at general approach to objects (not just collections). That is why I think Doc Brown answer is better. |
|
Jan 29 |
revised |
Best Practices Returning Read-Only Object added 47 characters in body |
|
Jan 29 |
asked | Best Practices Returning Read-Only Object |
|
Jan 14 |
awarded | Student |
|
Jan 11 |
awarded | Scholar |
|
Jan 11 |
accepted | Effective implementation of “array” of type Int X String -> String in .NET or in general |
|
Jan 11 |
comment |
Effective implementation of “array” of type Int X String -> String in .NET or in general Well as I have said the generic workflow is to create this table using database result set and then use this table to display a grid in ASP.NET (i.e. traverse all the cells one by one). But when simplified to this level I might just as well use a DataGridView with bound DataSource. Anyway, I think its fairly obvious that there is no hands-down better option available. I might use your suggestion to refactor the table into base class with common API and children that each implement the storage differently. |
|
Jan 11 |
awarded | Editor |
|
Jan 11 |
comment |
Effective implementation of “array” of type Int X String -> String in .NET or in general Thank you for the idea of composite keys, that sure is interesting approach. For clarifications please see my edit in the question area. |
|
Jan 11 |
revised |
Effective implementation of “array” of type Int X String -> String in .NET or in general added 593 characters in body |
|
Jan 11 |
asked | Effective implementation of “array” of type Int X String -> String in .NET or in general |