Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Login
Register
TheSwamp
»
Code Red
»
.NET
»
Topic:
The return integer value is not right by LispFunction .
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: The return integer value is not right by LispFunction . (Read 1613 times)
0 Members and 1 Guest are viewing this topic.
gswang
Newt
Posts: 117
The return integer value is not right by LispFunction .
«
on:
November 23, 2016, 01:37:48 AM »
public class MyCommands
{
[LispFunction("MyTest")]
public int MyLispFunction(ResultBuffer args) // This method can have any name
{
return 120000;
}
}
命令: (setq n (MyTest))
-11072
n is -11072, not 120000
why? thank you, everyone.
Logged
kpblc
Bull Frog
Posts: 396
Re: The return integer value is not right by LispFunction .
«
Reply #1 on:
November 23, 2016, 01:39:44 AM »
Try to use not int, but Int32
Logged
Sorry for my English.
gile
Gator
Posts: 2507
Marseille, France
WWW
Re: The return integer value is not right by LispFunction .
«
Reply #2 on:
November 23, 2016, 02:04:30 AM »
Hi
Returning a typed value instead of int (or Int32 which is the same) allows you to specify the returned type and avoids implicit cast from int to short).
Code - C#:
[Select]
[
LispFunction
(
"foo"
)
]
public
TypedValue Foo
(
ResultBuffer resbuf
)
{
return
new
TypedValue
(
(
int
)
LispDataType
.
Int32
,
120000
)
;
}
Logged
Speaking English as a French Frog
gswang
Newt
Posts: 117
Re: The return integer value is not right by LispFunction .
«
Reply #3 on:
November 23, 2016, 02:10:20 AM »
Success, thank you very much.
Logged
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
.NET
»
Topic:
The return integer value is not right by LispFunction .