Additionally, you don't really need result, you don't use it for anything. So, I recommend removing it, and rewriting the foreach as follows:
for (ulong i = 5; i < inputnumber; i += 2)
{
isprime = true;
foreach (ulong prime in primes)
{
if (i % prime == 0UL)
{
isprime = false;
break;
}
}
if (isprime == true)
{
primes.Add(i);
}
}
This gives you another speed boost, surprisingly.
Lastly, I recommend initializing the List with a default buffer. This should help avoid "resizing" that happens throughout the lifetime of the program. I used 500000, but as long as you use something reasonable (even 10000 is fine) it will give you a decent performance boost. (1-2%)
Overall, when we're done, the algorithm should look something like:
var primes = new List<ulong>(10000);
primes.Add(3);
bool isprime = false;
for (ulong i = 5; i < inputnumber; i += 2)
{
isprime = true;
foreach (ulong prime in primes)
{
if (i % prime == 0UL)
{
isprime = false;
break;
}
}
if (isprime == true)
{
primes.Add(i);
}
}
primes.Insert(0, 2);
int numberofprimes = primes.Count;