Click here to Skip to main content
15,394,131 members
Home / Discussions / C#
   

C#

 
AnswerRe: Retrieve name of Printer using SendMessage Pin
Rage12-Sep-12 6:40
professionalRage12-Sep-12 6:40 
GeneralRe: Retrieve name of Printer using SendMessage Pin
toBeH_S12-Sep-12 8:33
MembertoBeH_S12-Sep-12 8:33 
GeneralRe: Retrieve name of Printer using SendMessage Pin
Rage12-Sep-12 21:25
professionalRage12-Sep-12 21:25 
GeneralRe: Retrieve name of Printer using SendMessage Pin
toBeH_S16-Sep-12 15:18
MembertoBeH_S16-Sep-12 15:18 
QuestionRandom Permutation Interface Pin
Skippums11-Sep-12 15:58
MemberSkippums11-Sep-12 15:58 
AnswerRe: Random Permutation Interface Pin
Dave Kreskowiak11-Sep-12 17:44
mveDave Kreskowiak11-Sep-12 17:44 
AnswerRe: Random Permutation Interface Pin
BillWoodruff12-Sep-12 0:05
mveBillWoodruff12-Sep-12 0:05 
AnswerRe: Random Permutation Interface Pin
Pete O'Hanlon12-Sep-12 0:18
mvaPete O'Hanlon12-Sep-12 0:18 
Skippums wrote:
1. I cannot figure out how to modify the contents of an IEnumerable object.

As you've discovered, you can't change the object you're enumerating over because you'd invalidate the enumerator. What you could do, though, is not use the enumerator - instead, you can iterate over the collection by index using a for loop, and update the underlying array using that instead. So, your loop becomes something like:
C#
for (int i = 0; i < list.Count; i++)
{
  list[i] = tempArray[indexes[j++]];
}
Note that this isn't possible for something like a LinkedList.

As for the constraint - I'm afraid that you can't do this at the constraint level. You'd have to test this in the actual method body and raise an exception if it was the wrong type.

*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

"Mind bleach! Send me mind bleach!" - Nagy Vilmos


CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier


modified 12-Sep-12 7:28am.

GeneralRe: Random Permutation Interface Pin
Dave Kreskowiak12-Sep-12 2:21
mveDave Kreskowiak12-Sep-12 2:21 
AnswerRe: Random Permutation Interface Pin
BobJanova12-Sep-12 1:17
MemberBobJanova12-Sep-12 1:17 
GeneralRe: Random Permutation Interface Pin
Pete O'Hanlon12-Sep-12 1:27
mvaPete O'Hanlon12-Sep-12 1:27 
GeneralRe: Random Permutation Interface Pin
Skippums12-Sep-12 6:41
MemberSkippums12-Sep-12 6:41 
AnswerRe: Random Permutation Interface Pin
PIEBALDconsult12-Sep-12 3:07
professionalPIEBALDconsult12-Sep-12 3:07 
AnswerRe: Random Permutation Interface Pin
Skippums12-Sep-12 7:32
MemberSkippums12-Sep-12 7:32 
GeneralRe: Random Permutation Interface Pin
BillWoodruff13-Sep-12 2:37
mveBillWoodruff13-Sep-12 2:37 
GeneralRe: Random Permutation Interface Pin
PIEBALDconsult13-Sep-12 3:23
professionalPIEBALDconsult13-Sep-12 3:23 
GeneralRe: Random Permutation Interface Pin
PIEBALDconsult13-Sep-12 3:27
professionalPIEBALDconsult13-Sep-12 3:27 
GeneralRe: Random Permutation Interface Pin
Skippums13-Sep-12 7:27
MemberSkippums13-Sep-12 7:27 
Questionconvert xdocument to integer Pin
rachel_m11-Sep-12 12:16
Memberrachel_m11-Sep-12 12:16 
AnswerRe: convert xdocument to integer Pin
Pete O'Hanlon11-Sep-12 12:22
mvaPete O'Hanlon11-Sep-12 12:22 
GeneralRe: convert xdocument to integer Pin
rachel_m11-Sep-12 16:04
Memberrachel_m11-Sep-12 16:04 
GeneralRe: convert xdocument to integer Pin
Eddy Vluggen11-Sep-12 20:55
professionalEddy Vluggen11-Sep-12 20:55 
GeneralRe: convert xdocument to integer Pin
rachel_m12-Sep-12 4:44
Memberrachel_m12-Sep-12 4:44 
GeneralRe: convert xdocument to integer Pin
PIEBALDconsult13-Sep-12 3:29
professionalPIEBALDconsult13-Sep-12 3:29 
GeneralRe: convert xdocument to integer Pin
Pete O'Hanlon11-Sep-12 22:16
mvaPete O'Hanlon11-Sep-12 22:16 

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.