简体   繁体   English

C#输出控制台-“ System.Collection.Generic.Dictionary2 + ValueCollection” Kinect v2

[英]C# Output Console - “System.Collection.Generic.Dictionary2+ValueCollection” Kinect v2

I am new in c# and i have a problem with console output. 我是C#的新手,控制台输出有问题。 I have include using System and using System.IO But when i print something in console output i don't see nothing. 我包括使用System和System.IO,但是当我在控制台输出中打印某些内容时,我什么也看不到。 If i write: 如果我写:

`Console.WriteLine("AAAAAAA");`

But I don't see AAAAAAAA... why? 但是我看不到AAAAAAAA ...为什么?

I am in kinect FaceBasic code: And i want print a variable. 我在kinect FaceBasic代码中:而且我想打印一个变量。 (the FaceFrameResults values) (FaceFrameResults值)

The variable is FaceFrameResult.FacePointsInInfraredSpace Property. 变量是FaceFrameResult.FacePointsInInfraredSpace属性。

Type: IReadOnlyDictionary<FacePointType, Point>

( http://msdn.microsoft.com/en-us/library/hh136548.aspx ) http://msdn.microsoft.com/en-us/library/hh136548.aspx

I want to print this with this code: 我想用以下代码打印此:

Console.WriteLine("Key = {0}, Value = {1}",faceFrame.FaceFrameResult.FacePointsInColorSpace.Keys,faceFrame.FaceFrameResult.FacePointsInColorSpace.Values);

But nothing happens, and does not give me any errors or warnings. 但是什么也没有发生,并且不会给我任何错误或警告。 If i try to print the value using messagebox 如果我尝试使用消息框打印值

`MessageBox.Show(faceFrameResults[index].FacePointsInInfraredSpace.Values.ToString());`
`MessageBox.Show(faceFrameResults[index].FacePointsInInfraredSpace.Values);`

I obtain this: 我得到这个:

System.Collection.Generic.Dictionary'2+ValueCollection[Microsoft.Kinect.Face.FacePointType.Microsoft.Kinect.PointF] System.Collection.Generic.Dictionary'2 + ValueCollection [Microsoft.Kinect.Face.FacePointType.Microsoft.Kinect.PointF]

Which is the problem? 哪有问题 Thank you in advance for your reply! 预先感谢您的答复!

You are trying to print out a collection, you can't do this directly, you need to iterate over the collection and print out each item one by one. 您正在尝试打印一个集合,您不能直接执行此操作,您需要遍历该集合并逐个打印每个项目。 eg 例如

foreach(var kvp in faceFrame.FaceFrameResult.FacePointsInColorSpace)
{
    Console.WriteLine("Key = {0}, Value = {1}", kvp.Key, kvp.Value);
}

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

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