src/Types/New-XrmOptionSetValues.ps1
<#
.SYNOPSIS Initialize OptionSetValueCollection object instance. #> function New-XrmOptionSetValues { [CmdletBinding()] [OutputType("Microsoft.Xrm.Sdk.OptionSetValueCollection")] param ( [Parameter(Mandatory = $true)] [int[]] $Values ) begin { $StopWatch = [System.Diagnostics.Stopwatch]::StartNew(); Trace-XrmFunction -Name $MyInvocation.MyCommand.Name -Stage Start -Parameters ($MyInvocation.MyCommand.Parameters); } process { $optionSetValues = New-Object -TypeName "Microsoft.Xrm.Sdk.OptionSetValueCollection"; $Values | ForEach-Object { $optionSetValue = New-XrmOptionSetValue -Value $_; $optionSetValues.Add($optionSetValue); } [Microsoft.Xrm.Sdk.OptionSetValueCollection] $optionSetValues; } end { $StopWatch.Stop(); Trace-XrmFunction -Name $MyInvocation.MyCommand.Name -Stage Stop -StopWatch $StopWatch; } } Export-ModuleMember -Function New-XrmOptionSetValues -Alias *; |