コード例 #1
0
        private static void ListFaces()
        {
            ListFacesResponse response = null;

            Console.WriteLine("Faces in collection " + collectionId);

            String paginationToken = null;

            do
            {
                if (response != null)
                {
                    paginationToken = response.NextToken;
                }

                ListFacesRequest request = new ListFacesRequest()
                {
                    CollectionId = collectionId,
                    MaxResults   = 1,
                    NextToken    = paginationToken
                };

                response = rekognitionClient.ListFacesAsync(request).Result;
                foreach (Face face in response.Faces)
                {
                    Console.WriteLine(face.FaceId);
                }
            } while (response != null && !String.IsNullOrEmpty(response.NextToken));
        }
コード例 #2
0
        // snippet-start:[Rekognition.dotnetv3.ListFacesExample]
        public static async Task Main()
        {
            string collectionId = "MyCollection2";

            var rekognitionClient = new AmazonRekognitionClient();

            var listFacesResponse = new ListFacesResponse();

            Console.WriteLine($"Faces in collection {collectionId}");

            var listFacesRequest = new ListFacesRequest
            {
                CollectionId = collectionId,
                MaxResults   = 1,
            };

            do
            {
                listFacesResponse = await rekognitionClient.ListFacesAsync(listFacesRequest);

                listFacesResponse.Faces.ForEach(face =>
                {
                    Console.WriteLine(face.FaceId);
                });

                listFacesRequest.NextToken = listFacesResponse.NextToken;
            }while (!string.IsNullOrEmpty(listFacesResponse.NextToken));
        }