mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 20:56:02 +00:00
36 lines
1022 B
C#
36 lines
1022 B
C#
/********************************************************************++
|
|||
|
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
||
|
|
--********************************************************************/
|
||
|
|
|
||
|
|
#if !SILVERLIGHT
|
||
|
|
|
||
|
|
#if !CLR2
|
||
|
|
using System.Linq.Expressions;
|
||
|
|
#else
|
||
|
|
using Microsoft.Scripting.Ast;
|
||
|
|
#endif
|
||
|
|
|
||
|
|
using System;
|
||
|
|
|
||
|
|
namespace System.Management.Automation.ComInterop {
|
||
|
|
internal class ConvertArgBuilder : SimpleArgBuilder {
|
||
|
|
private readonly Type _marshalType;
|
||
|
|
|
||
|
|
internal ConvertArgBuilder(Type parameterType, Type marshalType)
|
||
|
|
: base(parameterType) {
|
||
|
|
_marshalType = marshalType;
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override Expression Marshal(Expression parameter) {
|
||
|
|
parameter = base.Marshal(parameter);
|
||
|
|
return Expression.Convert(parameter, _marshalType);
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override Expression UnmarshalFromRef(Expression newValue) {
|
||
|
|
return base.UnmarshalFromRef(Expression.Convert(newValue, ParameterType));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
#endif
|
||
|
|
|