The following code from my teammate works:
public T Get<T, V>(V repo, string pk, string rk) where T : Microsoft.WindowsAzure.StorageClient.TableServiceEntity where V : IAzureTable<T> { try { var item = repo.GetPkRk(pk, rk); if (item == null) throw new Exception(); return (T)item; } catch (Exception ex) { _ex.Errors.Add("", typeof(T).Name + rk + " does not exist"); throw _ex; } }
Call Code:
var account = base.Get<Account, IAzureTable<Account>>(_accountRepository, pk, rk);
Can this be simplified. The only type variable here is โAccountโ, and I wonder if it is possible to combine the types T and V into one, since V depends only on T.
source share