In short, there are three cases.
1. The physical interface limits throughput.
If the network interface is limiting, then that's the limit (duh :p) and latency does not matter as @Ramhound says.
2. Window limited
If the configured TCP maximum window at either end is limiting then
T <= min(rwnd,cwnd)/RTT
3. Packet loss limited
Packet loss can also limit throughput (by limiting the send window). We learn from The Macroscopic Behavior of the TCP Congestion Avoidance Algorithm that we can get the upper bound on throughput
T <= (MSS / RTT) * C/sqrt(p),
where p is the packet loss rate, and C is a constant (see article for explanation). This is not exact, there are a number of important assumptions, and different TCP flavors affect this too - but we see that packet loss affects throughput.
I don't quite see how how this helps you write a program in C#, but hope it gives you something :)