{"action":"opened","issue":{"url":"https://api.github.com/repos/Azure/azure-storage-net/issues/631","repository_url":"https://api.github.com/repos/Azure/azure-storage-net","labels_url":"https://api.github.com/repos/Azure/azure-storage-net/issues/631/labels{/name}","comments_url":"https://api.github.com/repos/Azure/azure-storage-net/issues/631/comments","events_url":"https://api.github.com/repos/Azure/azure-storage-net/issues/631/events","html_url":"https://github.com/Azure/azure-storage-net/issues/631","id":296427653,"number":631,"title":"Is it possible to tell if CloudQueueMessage contains string vs byte array?","user":{"login":"Jericho","id":112710,"avatar_url":"https://avatars0.githubusercontent.com/u/112710?v=4","gravatar_id":"","url":"https://api.github.com/users/Jericho","html_url":"https://github.com/Jericho","followers_url":"https://api.github.com/users/Jericho/followers","following_url":"https://api.github.com/users/Jericho/following{/other_user}","gists_url":"https://api.github.com/users/Jericho/gists{/gist_id}","starred_url":"https://api.github.com/users/Jericho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jericho/subscriptions","organizations_url":"https://api.github.com/users/Jericho/orgs","repos_url":"https://api.github.com/users/Jericho/repos","events_url":"https://api.github.com/users/Jericho/events{/privacy}","received_events_url":"https://api.github.com/users/Jericho/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-12T16:00:48Z","updated_at":"2018-02-12T16:00:48Z","closed_at":null,"author_association":"NONE","body":"When fetching a message from an Azure queue is there a way to know if the message was added as a string or as an array of bytes?\r\n\r\nIn my scenario it's important because I treat byte array differently than I do strings. Here's what I currently have:\r\n\r\n```csharp\r\nvar content = (object)null;\r\ntry\r\n{\r\n    content = cloudMessage.AsString;\r\n}\r\ncatch\r\n{\r\n    content = Deserialize(cloudMessage.AsBytes);\r\n}\r\n```\r\n\r\nThis code relies on the fact that retrieving the content as a string throws an exception. This assumption is true in my scenario because the serialize binary content can't be converted back into a string. As you can imagine I don't like to rely on an exception being thrown, especially since the vast majority of the messages I fetch from the azure queue contain binary data.\r\n\r\nWhat I'm looing for is to be able to do something like (pseudo-code):\r\n\r\n```csharp\r\nvar content = (object)null;\r\nif (cloudMessage.ContainsBinary)\r\n{\r\n    content = Deserialize(cloudMessage.AsBytes);\r\n}\r\nelse\r\n{\r\n    content = cloudMessage.AsString;\r\n}\r\n```"}}
{"actor":{"display_login":"Jericho"}}