Click here to Skip to main content
15,905,508 members
Home / Discussions / C#
   

C#

 
AnswerMy Vote of 1 Pin
Keith Barrow29-Oct-12 6:11
professionalKeith Barrow29-Oct-12 6:11 
AnswerRe: Charting example- high priority Pin
wizardzz29-Oct-12 11:19
wizardzz29-Oct-12 11:19 
GeneralRe: Charting example- high priority Pin
SagarGK29-Oct-12 17:10
SagarGK29-Oct-12 17:10 
GeneralRe: Charting example- high priority Pin
Member 939112629-Oct-12 22:18
Member 939112629-Oct-12 22:18 
GeneralRe: Charting example- high priority Pin
SagarGK29-Oct-12 22:24
SagarGK29-Oct-12 22:24 
QuestionRegex getting special characters Pin
PozzaVecia28-Oct-12 4:18
PozzaVecia28-Oct-12 4:18 
AnswerRe: Regex getting special characters Pin
Richard Andrew x6428-Oct-12 4:37
professionalRichard Andrew x6428-Oct-12 4:37 
AnswerRe: Regex getting special characters Pin
Richard MacCutchan28-Oct-12 5:17
mveRichard MacCutchan28-Oct-12 5:17 
AnswerRe: Regex getting special characters Pin
OriginalGriff29-Oct-12 1:27
mveOriginalGriff29-Oct-12 1:27 
QuestionHow do I expose the LoadCompleted method in the WebBrowser class in WPF C#? Pin
Xarzu27-Oct-12 19:00
Xarzu27-Oct-12 19:00 
AnswerRe: How do I expose the LoadCompleted method in the WebBrowser class in WPF C#? Pin
OriginalGriff27-Oct-12 22:14
mveOriginalGriff27-Oct-12 22:14 
AnswerRe: How do I expose the LoadCompleted method in the WebBrowser class in WPF C#? Pin
Richard MacCutchan28-Oct-12 0:21
mveRichard MacCutchan28-Oct-12 0:21 
QuestionHow to convert a string to an unique numeric value? Pin
gibsray27-Oct-12 1:09
gibsray27-Oct-12 1:09 
AnswerRe: How to convert a string to an unique numeric value? Pin
Alan N27-Oct-12 2:12
Alan N27-Oct-12 2:12 
AnswerRe: How to convert a string to an unique numeric value? Pin
Clifford Nelson29-Oct-12 9:56
Clifford Nelson29-Oct-12 9:56 
AnswerRe: How to convert a string to an unique numeric value? Pin
BobJanova29-Oct-12 23:39
BobJanova29-Oct-12 23:39 
QuestionWould you use a custom enumerator? Pin
DaveyM6926-Oct-12 21:40
professionalDaveyM6926-Oct-12 21:40 
I have a bunch of different structs that implement IMyType. I also have some more advanced structs that are essentially containers for x number of IMyType instances (they are not lists). They need to be iterated so I am implementing IEnumerable<IMyType>. At the moment I have made a custom enumerator that has a params IMyType[] myTypes parameter in the contructor and using this type of code in the IEnumerable structs:
C#
public IEnumerator<IMyType> GetEnumerator()
{
    return new MyTypeEnumerator(
        new IMyType[] { 
            new MyType(...), 
            new MyTypeOther(...) });
}

This works fine but I've been considering getting rid of the MyTypeEnumerator and using this instead:
C#
public IEnumerator<IMyType> GetEnumerator()
{
    IEnumerable<IMyType> collection = new IMyType[] { 
        new MyType(...), 
        new MyTypeOther(...) };
    return collection.GetEnumerator();
}

Obviously both work just fine and are pretty much identical. Which would you prefer?

Edit: Alternatively, I could just use return new MyTypeEnumerator(this); and let the MyTypeEnumerator take care of it. I don't like that idea - ignore
Dave

Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.
Astonish us. Be exceptional. (Pete O'Hanlon)

BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)




modified 27-Oct-12 10:19am.

AnswerRe: Would you use a custom enumerator? Pin
BobJanova29-Oct-12 0:32
BobJanova29-Oct-12 0:32 
GeneralRe: Would you use a custom enumerator? Pin
DaveyM6929-Oct-12 1:57
professionalDaveyM6929-Oct-12 1:57 
GeneralRe: Would you use a custom enumerator? Pin
BobJanova29-Oct-12 3:41
BobJanova29-Oct-12 3:41 
GeneralRe: Would you use a custom enumerator? Pin
DaveyM6929-Oct-12 11:00
professionalDaveyM6929-Oct-12 11:00 
AnswerRe: Would you use a custom enumerator? Pin
Richard Deeming29-Oct-12 2:17
mveRichard Deeming29-Oct-12 2:17 
GeneralRe: Would you use a custom enumerator? Pin
DaveyM6929-Oct-12 5:19
professionalDaveyM6929-Oct-12 5:19 
AnswerRe: Would you use a custom enumerator? Pin
Clifford Nelson29-Oct-12 8:52
Clifford Nelson29-Oct-12 8:52 
GeneralRe: Would you use a custom enumerator? Pin
DaveyM6929-Oct-12 10:45
professionalDaveyM6929-Oct-12 10:45 

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.