Click here to Skip to main content
15,899,825 members
Home / Discussions / C#
   

C#

 
AnswerCP Ignore - spamming the site Pin
Dave Kreskowiak4-Nov-08 10:36
mveDave Kreskowiak4-Nov-08 10:36 
AnswerREPORTED AS ABUSE Pin
leckey4-Nov-08 14:26
leckey4-Nov-08 14:26 
QuestionDirectoryInfo functionality for http paths Pin
kenrentz4-Nov-08 10:14
kenrentz4-Nov-08 10:14 
QuestionHow do I create a generic .Net event handler Pin
astibich24-Nov-08 9:59
astibich24-Nov-08 9:59 
AnswerRe: How do I create a generic .Net event handler Pin
Pete O'Hanlon4-Nov-08 11:51
mvePete O'Hanlon4-Nov-08 11:51 
GeneralRe: How do I create a generic .Net event handler Pin
Mark Churchill4-Nov-08 12:27
Mark Churchill4-Nov-08 12:27 
GeneralRe: How do I create a generic .Net event handler Pin
Pete O'Hanlon4-Nov-08 22:22
mvePete O'Hanlon4-Nov-08 22:22 
QuestionOverriding a Dictionary's Item property Pin
Clive D. Pottinger4-Nov-08 8:37
Clive D. Pottinger4-Nov-08 8:37 
Hello TCP gurus!

It's me again, standing in a the corner of a room with wet paint all around me.... Any help would be appreciated.

I have a dictionary
public class DataImage : Dictionary<string,>

which has been working wonderfully for me. But now I find that when I have a problem when adding values using the Item property.
DataImage<string,> modImage = new DataImage<string,>();
...
modImage["xxx"] = "yyy";

I need to have some additional actions occur. In particular, DataImage contains some private data that needs to be updated whenever an element is added or removed. I have the required code in the Add() and Remove() methods, but I also need that logic to occur when the dictionary is accessed using its Item property.

I would like to do something akin to
public override string Item[key]
{
  get { return base[key]; }
  set
  {
     base[key] = value;
     changeOtherStuff(key, value);
  }
}


I looked at this page (http://msdn.microsoft.com/en-us/library/9tee9ht2.aspx[^]), but couldn't see how to write the necessary code from it. I also searched online, but to no avail.

Clive Pottinger
Victoria, BC

AnswerRe: Overriding a Dictionary's Item property Pin
led mike4-Nov-08 9:23
led mike4-Nov-08 9:23 
GeneralRe: Overriding a Dictionary's Item property Pin
Clive D. Pottinger4-Nov-08 9:33
Clive D. Pottinger4-Nov-08 9:33 
AnswerRe: Overriding a Dictionary's Item property Pin
Wendelius4-Nov-08 9:25
mentorWendelius4-Nov-08 9:25 
GeneralRe: Overriding a Dictionary's Item property Pin
Clive D. Pottinger4-Nov-08 9:38
Clive D. Pottinger4-Nov-08 9:38 
AnswerRe: Overriding a Dictionary's Item property Pin
Clive D. Pottinger4-Nov-08 9:26
Clive D. Pottinger4-Nov-08 9:26 
QuestionHow can i allow only Integer value to be entered Pin
netJP12L4-Nov-08 8:24
netJP12L4-Nov-08 8:24 
AnswerRe: How can i allow only Integer value to be entered Pin
Pedram Behroozi4-Nov-08 9:04
Pedram Behroozi4-Nov-08 9:04 
GeneralRe: How can i allow only Integer value to be entered Pin
netJP12L5-Nov-08 9:58
netJP12L5-Nov-08 9:58 
GeneralRe: How can i allow only Integer value to be entered Pin
Pedram Behroozi6-Nov-08 0:17
Pedram Behroozi6-Nov-08 0:17 
QuestionFor all you C# geeks: Knock yourselves out [modified] Pin
Bulky Fellow4-Nov-08 8:04
Bulky Fellow4-Nov-08 8:04 
AnswerRe: For all you C# geeks: Knock yourselves out Pin
Guffa4-Nov-08 11:09
Guffa4-Nov-08 11:09 
AnswerRe: For all you C# geeks: Knock yourselves out Pin
Mark Churchill4-Nov-08 13:24
Mark Churchill4-Nov-08 13:24 
QuestionMulti-pass Data Overwrite Questions Pin
BugsSister4-Nov-08 7:59
BugsSister4-Nov-08 7:59 
AnswerRe: Multi-pass Data Overwrite Questions Pin
led mike4-Nov-08 9:36
led mike4-Nov-08 9:36 
GeneralRe: Multi-pass Data Overwrite Questions Pin
BugsSister5-Nov-08 7:33
BugsSister5-Nov-08 7:33 
QuestionGUI for a DOS program 2 questions ??? Pin
Questioneer4-Nov-08 7:33
Questioneer4-Nov-08 7:33 
AnswerRe: GUI for a DOS program 2 questions ??? Pin
Questioneer5-Nov-08 20:18
Questioneer5-Nov-08 20:18 

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.