Link to home
Start Free TrialLog in
Avatar of davesnb
davesnbFlag for Canada

asked on

convert member property to type int

Hello EE,

I have a member in a system.object of typename

TypeName: System.Management.Automation.PSCustomObject

Name            MemberType   Definition                          
----            ----------   ----------                          
Equals          Method       bool Equals(System.Object obj)      
GetHashCode     Method       int GetHashCode()                  
GetType         Method       type GetType()                      
ToString        Method       string ToString()                  
name            NoteProperty System.String name=tbl_Core_Auditing
TableDataSizeMB NoteProperty System.String TableDataSizeMB=5283  

As you can see there is tabledatasizemb as type system.string , i wish to convert this to int32 for each element in the array
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

you can use Int32.Parse(yourvariable.TabelDataSizeMB), this should return the int32 value for the string...
http://msdn.microsoft.com/en-us/library/system.int32.parse%28v=vs.110%29.aspx
Avatar of davesnb

ASKER

$tblsize = import-csv C:\Scripts\dump\tblsize\$datelog.csv
$tblsize | Int32.Parse($tblsize.TableDataSizeMB)

Open in new window


Sorry not familiar with the syntax here , returns " The term 'Int32.Parse' is not recognized as the name of a cmdlet.." when using Int32.Parse($tblsize.TabelDataSizeMB)
ASKER CERTIFIED SOLUTION
Avatar of footech
footech
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of davesnb

ASKER

great thanks