Questions tagged [readonly-collection]

Represents a strongly-typed, read-only collection of elements.

Represents a strongly-typed, read-only collection of elements.

105 questions
0
votes
0 answers

CollectionViewSource Filter doesn't work with ReadOnlyCollection

I set up an ItemsControl with the items source set to a List. I then filter this ItemsControl using code like the following: CollectionViewSource.GetDefaultView(myList).Filter = filterFunction; This worked as expected. However, I have since…
BPC
  • 3
  • 3
0
votes
0 answers

jdbc oracle read only access error when query with multiple database links

i have 3 read only user on 3 oracle databases db1, db2,db3 then when i log onto pl/sql on db1 with it, i can perform the query select 1 X from dual@db2 union select 2 X from dual@db3 then i tried the jdbc code  stmt=con.createStatement(); …
user999377
  • 71
  • 1
  • 6
0
votes
1 answer

.Item property of readOnlycollection doesn't work

Im making a project in Python, using CPython3.4. I imported a dll which contains a ReadOnlyCollection. How can I get one item(at index) out of that list? I already tried to use .Item(index) and .Items but it says that: "the object has no attribute…
0
votes
1 answer

Extension Method to an item of a ReadOnlyCollection

I have a ReadOnlyCollection of a custom Interface type (IMyInterface). I want to add an extension method to the custom Interface type. However, my extension method is not showing up when I access an item inside the ReadOnlyCollection. Here's my code…
Setafire
  • 719
  • 2
  • 9
  • 21
0
votes
2 answers

how to make accessor for Dictionary in a way that returned Dictionary cannot be changed C# / 2.0

I thought of solution below because the collection is very very small. But what if it was big? private Dictionary _folderData = new Dictionary(); public Dictionary FolderData { get { return…
char m
  • 7,840
  • 14
  • 68
  • 117
0
votes
2 answers

Readonly property set code repeated in several constructor

I have a DataStructure class, which I want to be immutable. Ordinarily, I'd just ensure that all my members are defined as readonly - Job Done. But one of the members is a list (of ints), so I need to ensure that the List can't be modified; so I…
Brondahl
  • 7,402
  • 5
  • 45
  • 74
0
votes
1 answer

Does AutoMapper support ReadOnlyCollections?

I have tried various configurations, but cannot get it working. I am wondering if it is supported?
Paul Hiles
  • 9,558
  • 7
  • 51
  • 76
0
votes
1 answer

How to Serialize class derived from ReadOnlyCollection

When I try to serialize my own class that is derived from ReadOnlyCollection I get the error: Type 'MyReadOnlyCollection`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' with…
openshac
  • 4,966
  • 5
  • 46
  • 77
0
votes
2 answers

BindingSource / BindingNavigator: How to prevent editing of bound DataSource?

I created a Data Source with VB.NET and Visual Studio 2005. I dragged the data source onto my dialog, and VS created the text boxes with the members of my linked Object, a System.Windows.Forms.BindingSource and a…
John
  • 15,990
  • 10
  • 70
  • 110
0
votes
2 answers

Encoding.GetString from an IReadOnlyList

Is there a way to get a string out of an IReadOnlyList, given a specific Encoding? To be more precise, is there a way that doesn't copy the content of the collection before passing it to the Encoding object? My main concern is performance,…
miniBill
  • 1,743
  • 17
  • 41
0
votes
3 answers

update Readonly int array?

In Classical sense Readonly objects can only be set in the constrcutor and cannot be modified later on. Why do readonly int arrays behave any different. PS:I am aware of Readonly collections, I am just curious to know why is this allowed ? class…
Rauld
  • 980
  • 2
  • 10
  • 19
0
votes
1 answer

accessing a nearly-readonly-shared-list Asynchronously

public class PlanetInfo { String planetName=""; int a; int b; int c; PlanetInfo(planetname){ planetName = planetname; if(planetName.equals("earth")){ a=1; //.... } else…
0
votes
2 answers

Protect lookup collections and items from editing

I don´t want anything of these to be editable at all. For the Collections it seems crystal clear to use ReadOnlyCollection (though I don´t know if it´s a good way of always creating a new ReadOnlyCollection from the Collection (is it…
timmkrause
  • 3,367
  • 4
  • 32
  • 59
-1
votes
1 answer

Read-Only violation on List in C#?

Is there any violation of the read only keyword when its used in combination with List ?? For example class Program { public List InputList; public List DefaultList; public readonly List ReadOnlyList; public…
Dhivya Sadasivam
  • 155
  • 2
  • 2
  • 14
-1
votes
2 answers

Update a ReadOnlyCollection in a GridView

I am trying to modify some code written by another gentleman that generates flat files in various formats. The particular flat file in question is one that is positionally defined - Value X is at position 10, Value Y at 17, and value Z at 26,…
DJGray
  • 504
  • 8
  • 26
1 2 3 4 5 6
7