BuildIt.CognitiveServices.CognitiveServiceClient.UploadAndDetectEmotion C# (CSharp) Method

UploadAndDetectEmotion() private method

private UploadAndDetectEmotion ( string subscriptionKey, Stream imageStream ) : Task
subscriptionKey string
imageStream Stream
return Task
        private async Task<Emotion[]> UploadAndDetectEmotion(string subscriptionKey, Stream imageStream)
        {
            try
            {
                var emotionServiceClient = new EmotionServiceClient(subscriptionKey);

                var emotionResult = await emotionServiceClient.RecognizeAsync(imageStream);
                return emotionResult;
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"Error {ex}");
                return null;
            }
        }