Refer the following code:
var acc = new CloudStorageAccount(
new StorageCredentials("account name", "account key"), false);
var tableClient = acc.CreateCloudTableClient();
var table = tableClient.GetTableReference("table name");
var entities = table.ExecuteQuery(new TableQuery<MyEntity>()).ToList();
However please keep in mind that table service returns a maximum of 1000 entities in a single call to it. If there're more than 1000 entities available in your table, it returns a continuation token which can be used to fetch next set of entities.
So, a better approach would be to use ExecuteQuerySegmented method and have your application deal with the token. Here's the sample code to do so:
var acc = new CloudStorageAccount(
new StorageCredentials("account name", "account key"), false);
var tableClient = acc.CreateCloudTableClient();
var table = tableClient.GetTableReference("table name");
TableContinuationToken token = null;
var entities = new List<MyEntity>();
do
{
var queryResult = table.ExecuteQuerySegmented(new TableQuery<MyEntity>(), token);
entities.AddRange(queryResult.Results);
token = queryResult.ContinuationToken;
} while (token != null);
Hope it helps!
If you need to know more about Azure, then you should join Azure cloud certification course today.
Thank you!!