The runtime uses reflection to look at the result type of your
LispFunction-attributed method, to determine what to return.
Unfortunately, in terms of LISP's dynamic and untyped nature,
that is nothing short of blasphemy.
I haven't tried it, but you might try declaring your function's
return type as 'object', and prey that the runtime wrapper will
look at the returned value's type and select the appropriate acedRetXxxx() function to call.
If it works, they're forgiven
🙂
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com
wrote in message news:5258429@discussion.autodesk.com...
Hi,
I am starting to work with autocad 2007 and C# 2005. I have a function that normally return a ResultBuffer. But when it encounter an error I would like to return a single string. Is it possible to do something like that ?
[LispFunction("TestFct")]
public ResultBuffer TestFct(ResultBuffer buf)
{
Array args = buf.AsArray();
string path = Convert.ToString(((TypedValue)(args.GetValue(0))).Value);
ResultBuffer buffResult = new ResultBuffer();
string[] directories = Directory.GetDirectories(path);
foreach (string subDirName in directories)
buffResult.Add(new TypedValue(RTSTR, subDirName.Substring(subDirName.LastIndexOf("\\") + 1)));
if (directories.Length = 0)
{
return "none"; // <-- will not work here. but it is the result that i would like.
}
}
--------------------
I would like to have "none" and not ("none").