[This topic is part of the Microsoft Azure Storage Client Library 1.7, which has been deprecated. See
Storage Client Library for the latest version.]
Indicates whether a connection string can be parsed to return a
CloudStorageAccount object.
Namespace: Microsoft.WindowsAzure
Assembly: Microsoft.WindowsAzure.StorageClient (in Microsoft.WindowsAzure.StorageClient.dll)
Usage
Visual Basic |
---|
Dim value As String
Dim account As CloudStorageAccount
Dim returnValue As Boolean
returnValue = CloudStorageAccount.TryParse(value, account) |
Syntax
Visual Basic |
---|
Public Shared Function TryParse ( _
value As String, _
<OutAttribute> ByRef account As CloudStorageAccount _
) As Boolean |
C# |
---|
public static bool TryParse (
string value,
out CloudStorageAccount account
) |
C++ |
---|
public:
static bool TryParse (
String^ value,
[OutAttribute] CloudStorageAccount^% account
) |
Parameters
- value
Type: System.String
The connection string to parse.
- account
A CloudStorageAccount object to hold the instance returned if the connection string can be parsed.
Return Value
Type:
System.Booleantrue if the connection string was successfully parsed; otherwise, false.
Example
The following code example attempts to parse a connection string and return a CloudStorageAccount object, then lists account, credential, and endpoint information.
C# | Copy Code |
---|
static void TryParseCloudStorageAccountFromConnectionString()
{
CloudStorageAccount storageAccount;
if (CloudStorageAccount.TryParse(ConfigurationManager.AppSettings["StorageAccountConnectionString"], out storageAccount))
{
Console.WriteLine("Connection string: {0}", storageAccount.ToString(true));
Console.WriteLine("Account name: {0}", storageAccount.Credentials.AccountName);
Console.WriteLine("Account key: {0}", ((StorageCredentialsAccountAndKey)storageAccount.Credentials).Credentials.ExportBase64EncodedKey());
Console.WriteLine("Blob endpoint: {0}", storageAccount.BlobEndpoint);
Console.WriteLine("Queue endpoint: {0}", storageAccount.QueueEndpoint);
Console.WriteLine("Table endpoint: {0}", storageAccount.TableEndpoint);
}
else
{
Console.WriteLine("The connection string could not be parsed.");
}
}
|
Remarks
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Platforms
Change History
See Also