Avatar of davesnb
davesnb
Flag 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
Powershell

Avatar of undefined
Last Comment
davesnb

8/22/2022 - Mon
Guy Hengel [angelIII / a3]

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
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
footech

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
davesnb

ASKER
great thanks
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy