Project Euler Problem 7: 10,001st prime The problem statement is as follows

By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the 10,001st prime number?

My code that follows is what I used to solve this with.
public class Program
{
    static bool IsPrime(long value)
    {
        if (value==2)
            return true;
        
        if (value % 2 ==0)
            return false;
        
        long largestPossibleFactor = (long)Math.Sqrt(value);
        for (int possiblePrimeFactor = 3; possiblePrimeFactor &lt;= largestPossibleFactor; possiblePrimeFactor +=2)
        {
            if (value % possiblePrimeFactor == 0)
                return false;
        }
        return true;
    }
    
    static long GetPrimeOccurence(int NthOccurence)
    {    
        if (NthOccurence==1)
            return 2;
        
        int primePosition=2;
        long returnValue=0;
        bool numberIsPrime =false;
        for (long testForPrime=3; primePosition &lt;= NthOccurence; testForPrime +=2)
        {
            numberIsPrime = IsPrime(testForPrime);
            
            if (numberIsPrime &amp;&amp; primePosition == NthOccurence)
                returnValue = testForPrime;
            
            if (numberIsPrime)
                primePosition++;
        }
        return returnValue;
    }
    
    public static void Main(string[] args)
    {
        Console.WriteLine(GetPrimeOccurence(10001));
    }
}
Aside from using a naive function to find prime, the GetPrimeOccurrence function could use some tightening up.  Most specifically the loop should use a shortcut and return as soon as the nth occurrence is reached:

static long GetPrimeOccurence(int NthOccurence)
{   
    if (NthOccurence==1)
        return 2;

    int primePosition=2;
    bool numberIsPrime =false;
    for (long testForPrime=3; primePosition &lt;= NthOccurence; testForPrime +=2)
    {
        numberIsPrime = IsPrime(testForPrime);

        if (numberIsPrime)
        {
            if(primePosition == NthOccurence)
            {
                return testForPrime;
            }
            primePosition++;
        }
    } 
    return 0;
}