How to access .NET objects

Nov 12, 2007 at 3:01 PM
Is there any way to access .NET classes, create delegates and event handlers from IronScheme?
Coordinator
Nov 15, 2007 at 9:57 PM


Devyar wrote:
Is there any way to access .NET classes, create delegates and event handlers from IronScheme?


At the moment, no, but it has that in the pipeline.
Coordinator
Nov 24, 2007 at 1:46 AM
Here is a small example for now, very primitive clr interaction.

IronScheme 1.0.0.0 http://www.codeplex.com/IronScheme Copyright (c) leppie 2007
> (define ht (make-eq-hashtable))
System.Collections.Hashtable
> (clr-call system.collections.hashtable:add ht 1 1)
> (clr-call system.collections.hashtable:get_item ht 1)
1
>
May 3, 2008 at 11:05 AM
how to call static methods like System.Console.WriteLine ???
this fails:
(import
(rnrs)
(ironscheme clr))
(clr-call system.console:writeline "test")
Coordinator
May 3, 2008 at 1:00 PM
Hi

The syntax has changed and been extended (quite soon after that post actually).

You would do that now like (note the casts as this is a heavily overloaded method):

(import (ironscheme clr))

(define (write-line fmt . args)
(clr-static-call system.console writeline (clr-cast system.string fmt) (clr-cast system.object[] (list->vector args))))

(write-line "{0}-{1}" "hello" "world")