[英]IronRuby Hash to C# Dictionary
How to convert Ruby Hash to C# Dictionary? 怎么把Ruby Hash转换成C#Dictionary?
Do we have any built-in function...or something? 我们有内置功能吗?
The .Net Dictionary type is a generic type which need special treatment in Ironruby. .Net字典类型是通用类型,在Ironruby中需要特殊对待。 By my knowledge you cannot cast a hash to a dictionary in ironruby. 据我所知,您无法在Ironruby中将哈希值投射到字典中。 But it should not be hard to write a helper function that does the conversion for you. 但是编写一个帮助您完成转换的辅助函数应该不难。 You may even open up the hash class in ruby and include the helper inside the hash so you can return a dictionary. 您甚至可以在ruby中打开哈希类,并将帮助程序包含在哈希中,以便您可以返回字典。
See the link below how this is done in C#. 请参阅下面的链接,以了解如何在C#中完成此操作。
convert HashTable to Dictionary in C# 在C#中将HashTable转换为Dictionary
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.