Search code examples
c#consoleoutputkinect-sdk

C# Output Console - "System.Collection.Generic.Dictionary2+ValueCollection" Kinect v2


I am new in c# and i have a problem with console output. I have include using System and using System.IO But when i print something in console output i don't see nothing. If i write:

`Console.WriteLine("AAAAAAA");`

But I don't see AAAAAAAA... why?

I am in kinect FaceBasic code: And i want print a variable. (the FaceFrameResults values)

The variable is FaceFrameResult.FacePointsInInfraredSpace Property.

Type: IReadOnlyDictionary<FacePointType, Point>

(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]

Which is the problem? Thank you in advance for your reply!


Solution

  • 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. e.g.

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