C# Solution:

Straight forward solution:

```
public int PivotIndex(int[] nums)
{
if (nums == null || nums.Length == 0)
return -1;
int sum = nums.Sum();
int leftsum = 0;
for (int i = 0; i < nums.Length; i++)
{
if ((sum = (sum - nums[i])) == leftsum)
return i;
else
leftsum += nums[i];
}
return -1;
}
```