Created
May 21, 2013 05:40
-
-
Save claudiosanchez/5617693 to your computer and use it in GitHub Desktop.
Generic Method for Getting Azure Objects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static T GetAzureObject<T>(string subscriptionId, string storageName, string uriFormat, params object[] parameters) where T:class, T:new() | |
| { | |
| var service = default(T); | |
| var requestUri = new Uri (string.Format(uriFormat, parameters)); | |
| var httpResponse = PerformHttpCall (subscriptionId, storageName); | |
| var serializer = new XmlSerializer (T); | |
| using (var memStream = new MemoryStream(Encoding.UTF8.GetBytes(httpResponse))) | |
| { | |
| service = (T)serializer.Deserialize(memStream); | |
| } | |
| return service; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment