Reputation: 800
I want to create a function like public static int Sum(int a, int b){ return 0; }
(in C#, not nemerle) that would be inside .n
document (not external dll) and be visiable for nemerle code. How to do such thing? (cant find examples on the web)
Upvotes: 0
Views: 164
Reputation: 175
No. But you can create a partial class. One part of the class can be written in Nemerle, and other in C#.
Upvotes: 1
Reputation: 1597
Nemerle allows class name in the using keyword for import static class methods.
module Functions {
public Sum(a : int, b : int): int { a+b }
}
// or
class Functions2 {
public static Mul(a : int, b : int): int { a*b }
}
using Functions;
using Functions2;
using System.Console;
module Program
{
Main() : void
{
WriteLine(Sum(2, 3));
WriteLine(Mul(4, 5));
}
}
Upvotes: 3