例如:
[DllImport("MyLibrary.dll")]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool MyMethod();
例如:
public class MyCustomAction
{
[CustomAction]
public static ActionResult MyMethod(Session session)
{
bool result = false;
try
{
result = MyLibrary.MyMethod();
}
catch (Exception ex)
{
// 处理异常
}
return result ? ActionResult.Success : ActionResult.Failure;
}
}
例如:
...
...
...