Also, you wouldn't happen to know how to replace elements in an array in bulk in something like PowerShell, would you?
I'm generating results from Exchange PowerShell cmd-lets, and they generate data objects that are basically large tables, and I effectively need to do a find and replace to remove prefixes in one column of the table.
I've been trying to find a way to start, but no dice so far.
An implicit cast is when an object is converted to a different type without you having to explicitly say so.
double y = 35; int x = (int)y; is an explicit cast.
int x = y; won't actually work in this case, because there would be data loss, so it requires you to explicitly state that you want the casting to happen.
foreach loops will take an array of "object" and allow you to say: object[] myObjects; foreach(Dog dog in myObjects){} and it will do a cast on each object to convert it to a Dog, and then throw an exception if it fails.
I've been working on a loop, but the problem I have is that it loops through a single object that has multiple elements in it, which then gets fed into another object that has multiple objects, so I've been having trouble targeting the changes across the entire set of output data. But thanks for the suggestions.
no subject
Date: 2010-08-30 11:12 pm (UTC)Also, you wouldn't happen to know how to replace elements in an array in bulk in something like PowerShell, would you?
I'm generating results from Exchange PowerShell cmd-lets, and they generate data objects that are basically large tables, and I effectively need to do a find and replace to remove prefixes in one column of the table.
I've been trying to find a way to start, but no dice so far.
no subject
Date: 2010-08-31 08:31 am (UTC)double y = 35;
int x = (int)y;
is an explicit cast.
int x = y;
won't actually work in this case, because there would be data loss, so it requires you to explicitly state that you want the casting to happen.
foreach loops will take an array of "object" and allow you to say:
object[] myObjects;
foreach(Dog dog in myObjects){}
and it will do a cast on each object to convert it to a Dog, and then throw an exception if it fails.
To do a find/replace on an array you want something like the syntax here:
http://ss64.com/ps/syntax-arrays.html
and the for loop here:
http://www.powershellpro.com/powershell-tutorial-introduction/logic-using-loops/
no subject
Date: 2010-08-31 08:36 am (UTC)