foreach

PowerShell ForEach / Piping confusion

I am using the TFS PowerTools Cmdlets in PowerShell to try to get at some information about Changesets and related WorkItems from my server. I have boiled the problem down to behavior I don't understand and I am hoping it is not TFS specific (so someone out there might be able to explain the problem to me :) ) Here's the only command th...

Foreach, special treatment of every n:th item (odd, even for example)

I have a foreach that looks like this: foreach ($blogusers as $bloguser) { $args = array( 'author' => $bloguser->user_id, 'showposts' => 1, 'caller_get_posts' => 1 ); ...

Converting Foreach Loop to Linq and getting error

I've currently got the following foreach loop: List<SearchResult> searchResults = new List<SearchResult>(); foreach (Transmission trans in Results) { searchResults.Add(new SearchResult(trans)); } return searchResults; And I'd like to convert this to a Linq expression, I've tried the following which looks like it achieve the same t...

Is it possible to iterate an mpl::vector at run time without instantiating the types in the vector?

Generally, I would use boost::mpl::for_each<>() to traverse a boost::mpl::vector, but this requires a functor with a template function declared like the following: template<typename T> void operator()(T&){T::staticCall();} My problem with this is that I don't want the object T to be instantiated by for_each<>. I don't need the T parame...

How do I run through an array where the first array member is a string that needs to be split.

I have an array {{".txt|.doc|.docx", "100000"}, {".xls|.xlsx|.xxx" , "10000"}, ".npp", "100000"} I am trying to find a way to run a foreach loop on each member of the array in a loop while also checking the first member as a string not an array. The code will search for all docs greater than 10000 bytes, as long as the docs are txt, do...