Click here to Skip to main content
15,895,799 members
Home / Discussions / C#
   

C#

 
QuestionRefactoring question Pin
Illegal Operation25-Aug-09 14:42
Illegal Operation25-Aug-09 14:42 
AnswerRe: Refactoring question Pin
Not Active25-Aug-09 15:03
mentorNot Active25-Aug-09 15:03 
AnswerRe: Refactoring question Pin
N a v a n e e t h25-Aug-09 16:26
N a v a n e e t h25-Aug-09 16:26 
QuestionConvert Process to the orginal C# COM class Pin
Gindi Bar Yahav25-Aug-09 13:07
Gindi Bar Yahav25-Aug-09 13:07 
Question[Message Deleted] Pin
WhiteWolf1925-Aug-09 11:49
WhiteWolf1925-Aug-09 11:49 
AnswerRe: C# code help Pin
Not Active25-Aug-09 12:20
mentorNot Active25-Aug-09 12:20 
AnswerRe: C# code help Pin
_Maxxx_25-Aug-09 19:38
professional_Maxxx_25-Aug-09 19:38 
QuestionEnumerator Pin
CodingYoshi25-Aug-09 11:06
CodingYoshi25-Aug-09 11:06 
I have a class which has a dictionary and I don't want to reveal this information to the outside. So I simply made it a private member. I want people to enumerate through my class so I did the following:

public class CustomerCollection : IEnumerable<KeyValuePair<string, Customer>>
{
#region IEnumerable<KeyValuePair<string,Store>> Members

public IEnumerator<KeyValuePair<string, Customer>> GetEnumerator()
{
      return this._districts.GetEnumerator();
}

#endregion

#region IEnumerable Members

IEnumerator IEnumerable.GetEnumerator()
{
      return this._districts.GetEnumerator();
}

#endregion
}

This works fine but during enumeration, the client has to write code as below:

foreach (KeyValuePair<string, Customer> c in this._customers) // _customers is an instance of CustomerCollection
{
c.Value.Name = "Whatever";
}

What should I do if I want the client to be able to do this:

foreach (Customer c in this._customers)
{
c.Name = "whatever";
}

CodingYoshi

Artificial Intelligence is no match for Human Stupidity.

AnswerRe: Enumerator Pin
Adam R Harris25-Aug-09 11:51
Adam R Harris25-Aug-09 11:51 
GeneralRe: Enumerator Pin
CodingYoshi25-Aug-09 17:20
CodingYoshi25-Aug-09 17:20 
AnswerRe: Enumerator Pin
DaveyM6925-Aug-09 11:51
professionalDaveyM6925-Aug-09 11:51 
AnswerRe: Enumerator Pin
Alan N25-Aug-09 13:45
Alan N25-Aug-09 13:45 
AnswerRe: Enumerator Pin
N a v a n e e t h25-Aug-09 16:36
N a v a n e e t h25-Aug-09 16:36 
GeneralRe: Enumerator Pin
CodingYoshi25-Aug-09 17:22
CodingYoshi25-Aug-09 17:22 
Questionbackgroundworker problem Pin
Planker25-Aug-09 10:26
Planker25-Aug-09 10:26 
AnswerRe: backgroundworker problem Pin
DaveyM6925-Aug-09 11:44
professionalDaveyM6925-Aug-09 11:44 
AnswerRe: backgroundworker problem Pin
N a v a n e e t h25-Aug-09 16:52
N a v a n e e t h25-Aug-09 16:52 
AnswerRe: backgroundworker problem Pin
Abdul Rahman Hamidy25-Aug-09 19:51
Abdul Rahman Hamidy25-Aug-09 19:51 
QuestionChanging Crystal Reports Details Section Height programmatically PinPopular
mj_developer25-Aug-09 9:29
mj_developer25-Aug-09 9:29 
QuestionSimple syntax error? Pin
Sonhospa25-Aug-09 9:26
Sonhospa25-Aug-09 9:26 
AnswerRe: Simple syntax error? [modified] Pin
Hristo-Bojilov25-Aug-09 9:47
Hristo-Bojilov25-Aug-09 9:47 
NewsRe: Simple syntax error? Pin
Sonhospa25-Aug-09 10:04
Sonhospa25-Aug-09 10:04 
GeneralRe: Simple syntax error? Pin
Hristo-Bojilov25-Aug-09 10:22
Hristo-Bojilov25-Aug-09 10:22 
GeneralRe: Simple syntax error? Pin
Sonhospa25-Aug-09 10:29
Sonhospa25-Aug-09 10:29 
GeneralRe: Simple syntax error? Pin
Hristo-Bojilov25-Aug-09 10:30
Hristo-Bojilov25-Aug-09 10:30 

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.