我在尝试访问另一个类中的静态方法时遇到C#错误.
这是尝试访问它的类:
class Problem7
{
public void Solve()
{
GimmePrimes(new long[]{2, 3, 5, 7, 11, 13});
}
}
Run Code Online (Sandbox Code Playgroud)
这是GimmePrimes所在的静态类:
public static class Extensions
{
//....Other static methods that work//
public static IEnumerable<long> GimmePrimes(this long[] firstPrimes)
{
return firstPrimes.Unfold(priorPrimes => priorPrimes.Last().OddNumbersGreaterThan().SkipWhile(candidate => priorPrimes.TakeWhile(prime => prime * prime <= candidate).Any(prime => candidate.IsDivisibleBy(prime))).First());
}
}
Run Code Online (Sandbox Code Playgroud)
两个类都在同一名称空间中.