C# XNA Xbox HashSet and Tuple

你说的曾经没有我的故事 提交于 2019-12-08 03:13:32

问题


C# XNA Xbox, in this case optional parameters are not optional

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.

I could write my own version of both classes. Tuple from scratch and HashSet using a Dictonary (possibly). 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?

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.

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


回答1:


There both very basic data structures you can just make your own.

Here is a 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; 
   } 
} 



回答2:


No, you cannot get the PC binaries and use them on the Xbox. They are compiled for different hardware and an XNA X360 project will refuse to use PC dlls.

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).



来源:https://stackoverflow.com/questions/9966336/c-sharp-xna-xbox-hashset-and-tuple

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!