Should I use an intermediate variable in a complex C# expression? Can anyone please tell which one is the more effective way to write C# code, among the two options below?

Option A:

internal static string GetLast3Years()
{
    return (DateTime.Now.Year - 2).ToString() + "," + (DateTime.Now.Year - 1).ToString() + "," + DateTime.Now.Year.ToString();
}


Or option B:

internal static string GetLast3Years()
{
    int currentYear = DateTime.Now.Year;
    return (currentYear - 2).ToString() + "," + (currentYear - 1).ToString() + "," + currentYear.ToString();
}
Note that semantically these options are not equal. 

There is a chance (very-very small) that first option will output smth like 2011,2012,2014, so second option is better at least because it will always generate consistent results (3 consecutive years).

But second option is also quite cluttered. There is a string.Join method that is able to combine different values with separator, so your code may look like:

internal static string GetLast3Years()
{
    int currentYear = DateTime.Now.Year;
    return string.Join(",", currentYear - 2, currentYear - 1, currentYear);
}


But the question is still why would you need a string representation of last 3 years, comma-separated. I would consider having a method that will return enumerable of last N years instead...