Click here to Skip to main content
15,885,435 members
Home / Discussions / C#
   

C#

 
GeneralRe: Administrator Privileges Pin
Kannan Kalyanaraman27-Aug-03 1:11
Kannan Kalyanaraman27-Aug-03 1:11 
GeneralRe: Administrator Privileges Pin
Mazdak27-Aug-03 8:51
Mazdak27-Aug-03 8:51 
Generalstore users settings Pin
Member 50926226-Aug-03 23:30
Member 50926226-Aug-03 23:30 
GeneralRe: store users settings Pin
Kannan Kalyanaraman27-Aug-03 1:19
Kannan Kalyanaraman27-Aug-03 1:19 
GeneralRe: store users settings Pin
Member 50926227-Aug-03 10:47
Member 50926227-Aug-03 10:47 
GeneralRe: store users settings Pin
Nick Parker27-Aug-03 6:03
protectorNick Parker27-Aug-03 6:03 
GeneralRe: store users settings Pin
Frank Olorin Rizzi28-Aug-03 1:37
Frank Olorin Rizzi28-Aug-03 1:37 
QuestionHow to create a property to get a list on which it'd be impossible to add, replace or remove items ? Pin
Eric Marchesin26-Aug-03 21:25
Eric Marchesin26-Aug-03 21:25 
Simply, I'd like to create a get property that would return a list of objects for a class, but I want that the list only allows access to items : adding, replacing or removing items must be impossible.

To do that I first wrote the following code :

class MyClass
{
	private ArrayList _AL;
	
	ICollection MyList
	{
		get { return _AL; }
	}
}

Indeed, the ICollection doesn't have Add, Replace or Remove methods.
But I realized later that the ICollection interface returned by MyList could be cast into an IList interface on which it is possible to perform such operations, and then the list can be modified : the data can be acted an unexcepted way, and there is no integrity !Confused | :confused:

Does anyone know the answer to this architecture problem ?
Regards,

- Éric -
AnswerRe: How to create a property to get a list on which it'd be impossible to add, replace or remove items ? Pin
Kannan Kalyanaraman27-Aug-03 1:21
Kannan Kalyanaraman27-Aug-03 1:21 
GeneralRe: How to create a property to get a list on which it'd be impossible to add, replace or remove items ? Pin
Eric Marchesin27-Aug-03 2:02
Eric Marchesin27-Aug-03 2:02 
GeneralRe: How to create a property to get a list on which it'd be impossible to add, replace or remove items ? Pin
leppie27-Aug-03 10:30
leppie27-Aug-03 10:30 
GeneralRe: How to create a property to get a list on which it'd be impossible to add, replace or remove items ? Pin
Eric Marchesin27-Aug-03 23:54
Eric Marchesin27-Aug-03 23:54 
GeneralRe: How to create a property to get a list on which it'd be impossible to add, replace or remove items ? Pin
leppie28-Aug-03 6:58
leppie28-Aug-03 6:58 
AnswerRe: How to create a property to get a list on which it'd be impossible to add, replace or remove items ? Pin
Meysam Mahfouzi27-Aug-03 1:28
Meysam Mahfouzi27-Aug-03 1:28 
GeneralRe: How to create a property to get a list on which it'd be impossible to add, replace or remove items ? Pin
Eric Marchesin28-Aug-03 1:03
Eric Marchesin28-Aug-03 1:03 
AnswerRe: How to create a property to get a list on which it'd be impossible to add, replace or remove items ? Pin
Alvaro Mendez27-Aug-03 9:31
Alvaro Mendez27-Aug-03 9:31 
GeneralRe: How to create a property to get a list on which it'd be impossible to add, replace or remove items ? Pin
Alvaro Mendez27-Aug-03 10:47
Alvaro Mendez27-Aug-03 10:47 
GeneralRe: How to create a property to get a list on which it'd be impossible to add, replace or remove items ? Pin
Anonymous27-Aug-03 23:52
Anonymous27-Aug-03 23:52 
GeneralC# applect param pass problem Pin
aw1ay26-Aug-03 20:34
aw1ay26-Aug-03 20:34 
GeneralGPRS communication - PocketPC-SmartPhone.. Pin
ZippyBubbleHead26-Aug-03 20:14
ZippyBubbleHead26-Aug-03 20:14 
Generalhelp option... Pin
Member 52474026-Aug-03 20:05
Member 52474026-Aug-03 20:05 
GeneralRe: help option... Pin
Kannan Kalyanaraman27-Aug-03 23:19
Kannan Kalyanaraman27-Aug-03 23:19 
Generalchecking items in a ListView Pin
Member 50926226-Aug-03 20:02
Member 50926226-Aug-03 20:02 
GeneralRe: checking items in a ListView Pin
ZippyBubbleHead26-Aug-03 20:38
ZippyBubbleHead26-Aug-03 20:38 
GeneralRe: checking items in a ListView Pin
Member 50926226-Aug-03 21:55
Member 50926226-Aug-03 21:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.