简体   繁体   English

C#XNA Xbox HashSet和Tuple

[英]C# XNA Xbox HashSet and Tuple

C# XNA Xbox, in this case optional parameters are not optional C#XNA Xbox,在这种情况下,可选参数不是可选的

Thanks to help from the above question optional parameters are now working, or at least appear as if they should work. 感谢上述问题的帮助,可选参数现在正在运行,或者至少看起来好像它们应该有效。

However I'm now stuck on HashSets and Tuples, that don't appear to be available either. 但是我现在卡在HashSets和Tuples上,它们似乎也没有。

I could write my own version of both classes. 我可以编写自己的两个类的版本。 Tuple from scratch and HashSet using a Dictonary (possibly). 从头开始的元组和使用Dictonary(可能)的HashSet。 However I'd rather keep to using the standard ones. 但是我宁愿继续使用标准的。

If these classes exist in the PC verstion of the library, then can I copy and paste them from the PC C# library into my own code? 如果这些类存在于库的PC版本中,那么我可以将它们从PC C#库复制并粘贴到我自己的代码中吗?

Using "Go To Definition" results in "HashSet [from metadata]" and is C++ header file like in that it shows the classes interface but no implementation. 使用“转到定义”会导致“HashSet [来自元数据]”并且是C ++头文件,就像它显示类接口但没有实现。

Continued here: stackoverflow.com/questions/10246572/c-sharp-hashset2-to-work-exactly-like-the-standard-c-sharp-hashset-not-compilin 接下来是: stackoverflow.com/questions/10246572/c-sharp-hashset2-to-work-exactly-like-the-standard-c-sharp-hashset-not-compilin

There both very basic data structures you can just make your own. 有两种非常基本的数据结构,你可以自己创建。

Here is a HashSet. 这是一个HashSet。

And Here is a Tuple just add more items as needed. 这里是一个元组,只需根据需要添加更多项目。

public class Tuple<T1, T2> 
{ 
   public T1 Item1 { get; set; } 
   public T2 Item2 { get; set; } 

   public Tuple(T1 item1, T2 item2) 
   { 
      Item1 = item1; 
      Item2 = item2; 
   } 
} 

No, you cannot get the PC binaries and use them on the Xbox. 不,你无法获得PC二进制文件并在Xbox上使用它们。 They are compiled for different hardware and an XNA X360 project will refuse to use PC dlls. 它们针对不同的硬件进行编译,XNA X360项目将拒绝使用PC dll。

There are probably several implementations of those classes around. 这些类可能有几种实现。 I'm pretty sure many physics and engine projects in CodePlex have them already, and picking them is perfectly legal (although showing recognition is always recommended). 我很确定CodePlex中的许多物理和引擎项目已经拥有它们,并且选择它们是完全合法的(尽管总是建议显示识别)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM