It's a task from a C#-course I'm currently taking. The task is to write a method, which returns the first twenty Fibonacci-numbers.
I have done it the following way.
using System;
namespace CrashCourse
{
public class Fibonacci
{
// ... The actual method
public static List<int> GetNumbers() {
var numbs = new List<int> { 1, 1 }; // Provided. Not by myself.
for (var i = 2; i < 20; i++) {
var prev2 = numbs[i - 2];
var prev1 = numbs[i - 1];
numbs.Add(prev1 + prev2);
}
return numbs;
}
}
}
// Usage
var numbs = Fibonacci.GetNumbers();
foreach(var numb in numbs) {
Console.WriteLine(numb);
}
What's your opinion about my coding concerning naming, style and algorithm?
What should I do differently and why?