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

C#

 
GeneralRe: i cant understand logic code ...help me Pin
Nguyen Jay3-Jan-15 22:54
Nguyen Jay3-Jan-15 22:54 
GeneralRe: i cant understand logic code ...help me Pin
OriginalGriff3-Jan-15 23:11
mveOriginalGriff3-Jan-15 23:11 
GeneralRe: i cant understand logic code ...help me Pin
Nguyen Jay3-Jan-15 23:15
Nguyen Jay3-Jan-15 23:15 
AnswerRe: i cant understand logic code ...help me Pin
Abhinav S4-Jan-15 1:17
Abhinav S4-Jan-15 1:17 
GeneralRe: i cant understand logic code ...help me Pin
Nguyen Jay4-Jan-15 1:34
Nguyen Jay4-Jan-15 1:34 
AnswerRe: i cant understand logic code ...help me Pin
Abhinav S4-Jan-15 16:05
Abhinav S4-Jan-15 16:05 
QuestionHelp me ... IEnumerable/IEnumerator Pin
Nguyen Jay3-Jan-15 17:54
Nguyen Jay3-Jan-15 17:54 
AnswerRe: Help me ... IEnumerable/IEnumerator PinPopular
BillWoodruff3-Jan-15 19:47
professionalBillWoodruff3-Jan-15 19:47 
I suggest you start by reading this CodeProject article: [^].

You use these interfaces when the standard built-in iterators like 'foreach (which use these interfaces !) do not provide the functionality you wish to have in sequential access of a Collection of objects. Or, as in this example, to enable a Class which is not natively enumerable to act like it is by exposing a private collection defined in the Class.

For example, if you implement a Class that contains some form of custom Collection, which is private to the Class, but you want to be able to use 'foreach on an 'instance of that Class, and have the 'foreach loop move in sequence through the private custom-collection, you can have the Class implement (inherit from) IEnumerable, and then have the Class instance expose the Enumerator of the private Collection by making the private Collection's Enumerator be accessed in the implementation of the required 'GetEnumerator method.

Sound complex ? It's really not:

C#
//
public class SomeClass: IEnumerable
{
    private List<string> ListOStrings;


    public SomeClass()
    {
        ListOStrings = new List<string>
        {
          "one","two","three"      
        };
    }

    public IEnumerator GetEnumerator()
    {
        return ListOStrings.GetEnumerator();
    }
}

// now you can access the private List like this: in a method or EventHandler:

SomeClass someClass = new SomeClass();

foreach (var str in someClass)
{
    Console.WriteLine(str);
}
Also suggest you read: [^].
«A man will be imprisoned in a room with a door that's unlocked and opens inwards ... as long as it does not occur to him to pull rather than push»  Wittgenstein

GeneralRe: Help me ... IEnumerable/IEnumerator Pin
Nguyen Jay3-Jan-15 20:06
Nguyen Jay3-Jan-15 20:06 
QuestionFEATURE_BROWSER_EMULATION for Class Addin Pin
Member 113215783-Jan-15 9:57
Member 113215783-Jan-15 9:57 
AnswerRe: FEATURE_BROWSER_EMULATION for Class Addin Pin
BillWoodruff3-Jan-15 11:55
professionalBillWoodruff3-Jan-15 11:55 
GeneralRe: FEATURE_BROWSER_EMULATION for Class Addin Pin
Member 113215783-Jan-15 15:13
Member 113215783-Jan-15 15:13 
GeneralRe: FEATURE_BROWSER_EMULATION for Class Addin Pin
BillWoodruff3-Jan-15 15:35
professionalBillWoodruff3-Jan-15 15:35 
QuestionSearch options Database Pin
rattlerrFx3-Jan-15 6:38
rattlerrFx3-Jan-15 6:38 
AnswerRe: Search options Database Pin
DamithSL3-Jan-15 14:55
professionalDamithSL3-Jan-15 14:55 
GeneralRe: Search options Database Pin
rattlerrFx3-Jan-15 15:15
rattlerrFx3-Jan-15 15:15 
QuestionProblem sending bulk mails with multiple attachments. Pin
Member 108281323-Jan-15 5:09
Member 108281323-Jan-15 5:09 
AnswerRe: Problem sending bulk mails with multiple attachments. Pin
Richard MacCutchan3-Jan-15 5:17
mveRichard MacCutchan3-Jan-15 5:17 
QuestionEmailing Image To Tumblr Pin
JBHowl3-Jan-15 1:12
JBHowl3-Jan-15 1:12 
AnswerRe: Emailing Image To Tumblr Pin
DamithSL3-Jan-15 1:31
professionalDamithSL3-Jan-15 1:31 
GeneralRe: Emailing Image To Tumblr Pin
JBHowl3-Jan-15 1:45
JBHowl3-Jan-15 1:45 
SuggestionRe: Emailing Image To Tumblr Pin
Richard MacCutchan3-Jan-15 1:54
mveRichard MacCutchan3-Jan-15 1:54 
AnswerRe: Emailing Image To Tumblr Pin
JBHowl3-Jan-15 3:56
JBHowl3-Jan-15 3:56 
GeneralRe: Emailing Image To Tumblr Pin
Richard MacCutchan3-Jan-15 5:15
mveRichard MacCutchan3-Jan-15 5:15 
GeneralRe: Emailing Image To Tumblr Pin
Dave Kreskowiak3-Jan-15 8:24
mveDave Kreskowiak3-Jan-15 8:24 

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.