Haxe 如何使用字典<;T、 U>;。带有@的枚举数:本机外部
看来Haxe 如何使用字典<;T、 U>;。带有@的枚举数:本机外部,haxe,Haxe,看来 @:native('System.Collections.Generic.Dictionary') extern class Dictionary<T, U> @:native('System.Collections.Generic.Dictionary')) 外部类词典 有效,但它似乎不适用于泛型类的嵌套类 我想用Haxe编写,使用我自己的“extern类”桥,类似于: struct K { string x; } struct V { string y;
@:native('System.Collections.Generic.Dictionary')
extern class Dictionary<T, U>
@:native('System.Collections.Generic.Dictionary'))
外部类词典
有效,但它似乎不适用于泛型类的嵌套类
我想用Haxe编写,使用我自己的“extern类”桥,类似于:
struct K {
string x;
}
struct V {
string y;
}
class Foo {
public void foo(Dictionary<K, V> d) {
Dictionary<K,V>.Enumerator e = d.GetEnumerator();
while (e.MoveNext()) {
Debug.Log(e.Current.Key.x);
Debug.Log(e.Current.Value.y);
}
}
}
struct K{
字符串x;
}
结构V{
弦y;
}
福班{
公开作废foo(字典d){
Dictionary.Enumerator e=d.GetEnumerator();
while(如MoveNext()){
Debug.Log(e.Current.Key.x);
Debug.Log(e.Current.Value.y);
}
}
}
您能提供更多的上下文吗?你为哪个目标而写作?您遇到了什么错误消息?你有完整的、可编译的代码样本可以分享吗?目标是C#。我想使用“@:本机外部”访问System.Collections.Generic.Dictionary.Enumerator。但是我不能完全想象语法,因此还没有编译错误。您应该发布一些工作的C代码,以便我们可以尝试帮助您将其转换为Haxe。您能提供更多上下文吗?你为哪个目标而写作?您遇到了什么错误消息?你有完整的、可编译的代码样本可以分享吗?目标是C#。我想使用“@:本机外部”访问System.Collections.Generic.Dictionary.Enumerator。但是我不能完全想象语法,因此还没有编译错误。您应该发布一些工作的C代码,以便我们可以尝试帮助您将其转换为Haxe。