Skip to content

Commit b260098

Browse files
committed
t
1 parent 9c1908e commit b260098

3 files changed

Lines changed: 15 additions & 1 deletion

File tree

CLRSharp/CLRSharp/Type/System/System_Type.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ public object Invoke(ThreadContext context, object _this, object[] _params)
304304
var _paramsdef = method_System.GetParameters();
305305
for (int i = 0; i < _params.Length; i++)
306306
{
307-
if (_params[i] is CLRSharp.StackFrame.RefObj)
307+
if (_params[i] is CLRSharp.StackFrame.RefObj)//特殊处理outparam
308308
{
309309
object v = (_params[i] as CLRSharp.StackFrame.RefObj).Get();
310310
if (v is VBox)
@@ -314,6 +314,11 @@ public object Invoke(ThreadContext context, object _this, object[] _params)
314314
hasref[i] = v;
315315
_outp[i] = v;
316316
}
317+
else if (_paramsdef[i].ParameterType.IsEnum)//特殊处理枚举
318+
{
319+
var ms = _paramsdef[i].ParameterType.GetMethods();
320+
_outp[i] = Enum.ToObject(_paramsdef[i].ParameterType, _params[i]);
321+
}
317322
else
318323
{
319324
_outp[i] = _params[i];

UnitTest/CLScriptExt/Country.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Text;
4+
using UnitTest;
45

56
namespace CLScriptExt
67
{
@@ -12,6 +13,10 @@ public enum Country:ushort
1213
};
1314
public class UserData
1415
{
16+
public static void ShowContry(Country c)
17+
{
18+
Logger.Log(c.ToString());
19+
}
1520
public static UserData g_this = new UserData();
1621
public static UserData Instance()
1722
{

UnitTestDll/Test0.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ namespace UnitTestDll
99
//随手写的测试用例,目标是啥也不知道
1010
public class Test0
1111
{
12+
public static void UnitTest_passEnum()
13+
{
14+
UserData.ShowContry(Country.Chinese);
15+
}
1216
public static void UnitTest_delegate()
1317
{
1418
TestDele.myup calBak = new TestDele.myup(target1);

0 commit comments

Comments
 (0)