Click here to Skip to main content
15,892,797 members
Home / Discussions / C#
   

C#

 
AnswerWild guess worked Pin
Colin Angus Mackay13-Jul-06 0:34
Colin Angus Mackay13-Jul-06 0:34 
QuestionAllowing a webservice to invoke a function from a windows application Pin
ZeinaBaG13-Jul-06 0:23
ZeinaBaG13-Jul-06 0:23 
Questionbinlllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll Pin
arun.m13-Jul-06 0:19
arun.m13-Jul-06 0:19 
AnswerRe: binlllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll Pin
Corinna John13-Jul-06 0:39
Corinna John13-Jul-06 0:39 
AnswerRe: binl... Pin
Ravi Bhavnani13-Jul-06 2:48
professionalRavi Bhavnani13-Jul-06 2:48 
AnswerRe: binlllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll Pin
LongRange.Shooter13-Jul-06 3:33
LongRange.Shooter13-Jul-06 3:33 
QuestionProblem with C++ wchar_t To C# ... Pin
SD312-Jul-06 23:56
SD312-Jul-06 23:56 
Questionreadonly List members Pin
GDavy12-Jul-06 23:36
GDavy12-Jul-06 23:36 
I got the following problem I have a class that contains a List<t> member.

I want the users to have access to that list, but only to read the data. So I implemented a property that returns the list.
The list is indeed readonly meaning I can^t add remove or change any references in the list. However I can change the values of the references. Is there anyway I can avoid that?
simple example:

The basics of the wrapper
<br />
class listWrapper<X> where X : class<br />
{<br />
  private List<X> myList;<br />
  public List<X> TheList <br />
  { <br />
   get { return myList.AsReadOnly(); } <br />
  }<br />
  public listWrapper()<br />
  {  // I could show you how I fix the list here, but I'ld have to shoot you then.}<br />
<br />
  // ....<br />
}


For the sake of the example a simple class with a property
<br />
class SomeObject<br />
    {<br />
        private int aProp;<br />
        public int ACertainProp<br />
        {<br />
            get { return aProp; }<br />
            set { aProp = value; }<br />
        }<br />
   }<br />


And finally a class using the wrapper
<br />
    class AnotherClass<br />
    {<br />
        public void Method()<br />
        {<br />
            listWrapper<SomeObject> wrapper = new listWrapper<SomeObject>();<br />
<br />
//Here wrapper.TheList is completely readonly -> I can not change the references, however I also want the objects themselves to be readonly<br />
//so following should not be possible<br />
SomeObject anObject = wrapper.TheList[0];<br />
anObject.ACertainProp = 15; //don^t want this to be possible<br />
}<br />
    }

AnswerRe: readonly List members [modified] Pin
Roger Alsing13-Jul-06 0:01
Roger Alsing13-Jul-06 0:01 
QuestionDateTime from String Pin
V.12-Jul-06 23:32
professionalV.12-Jul-06 23:32 
AnswerRe: DateTime from String Pin
Stefan Troschuetz12-Jul-06 23:54
Stefan Troschuetz12-Jul-06 23:54 
GeneralRe: DateTime from String Pin
V.13-Jul-06 0:06
professionalV.13-Jul-06 0:06 
GeneralRe: DateTime from String Pin
Guffa13-Jul-06 0:16
Guffa13-Jul-06 0:16 
GeneralRe: DateTime from String Pin
V.13-Jul-06 0:30
professionalV.13-Jul-06 0:30 
QuestionConvert hex char to byte Pin
bluish12-Jul-06 23:18
bluish12-Jul-06 23:18 
AnswerRe: Convert hex char to byte [modified] Pin
sjembek13-Jul-06 0:20
sjembek13-Jul-06 0:20 
AnswerRe: Convert hex char to byte [modified] Pin
stancrm13-Jul-06 0:27
stancrm13-Jul-06 0:27 
GeneralRe: Convert hex char to byte Pin
bluish13-Jul-06 3:13
bluish13-Jul-06 3:13 
GeneralRe: Convert hex char to byte Pin
stancrm13-Jul-06 3:32
stancrm13-Jul-06 3:32 
QuestionMulti Threading Pin
kulile12-Jul-06 22:57
kulile12-Jul-06 22:57 
AnswerRe: Multi Threading Pin
Corinna John12-Jul-06 23:07
Corinna John12-Jul-06 23:07 
GeneralRe: Multi Threading Pin
Roger Alsing13-Jul-06 1:41
Roger Alsing13-Jul-06 1:41 
GeneralRe: Multi Threading Pin
Not Active13-Jul-06 2:48
mentorNot Active13-Jul-06 2:48 
GeneralRe: Multi Threading Pin
Corinna John13-Jul-06 3:36
Corinna John13-Jul-06 3:36 
GeneralRe: Multi Threading Pin
Not Active13-Jul-06 3:48
mentorNot Active13-Jul-06 3:48 

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.