Team Ai
Datasetpublic

MegaBites-AI/Windows-powershell

sourceHugging Facemitupdated 6mo agoView on Hugging Face
0likes372downloads
SimpleArgBuilder.cs38 linesDownload Raw Back to ComInterop
1// Licensed to the .NET Foundation under one or more agreements.2// The .NET Foundation licenses this file to you under the MIT license.3 4using System;5using System.Diagnostics;6using System.Linq.Expressions;7 8namespace System.Management.Automation.ComInterop9{10    /// <summary>11    /// SimpleArgBuilder produces the value produced by the user as the argument value.  It12    /// also tracks information about the original parameter and is used to create extended13    /// methods for params arrays and param dictionary functions.14    /// </summary>15    internal class SimpleArgBuilder : ArgBuilder16    {17        internal SimpleArgBuilder(Type parameterType)18        {19            ParameterType = parameterType;20        }21 22        protected Type ParameterType { get; }23 24        internal override Expression Marshal(Expression parameter)25        {26            Debug.Assert(parameter != null);27            return Helpers.Convert(parameter, ParameterType);28        }29 30        internal override Expression UnmarshalFromRef(Expression newValue)31        {32            Debug.Assert(newValue != null && newValue.Type.IsAssignableFrom(ParameterType));33 34            return base.UnmarshalFromRef(newValue);35        }36    }37}38