[Solved] DateTime does not contain a defintion for the method and no accessible extension method accepting a first argument of type DateTime could be found [closed]


well the syntax was wrong, that’s all. It should be public static int CalculateAge(this DateTime bornDate). No dot between this and DateTime. But you absolutely need this when declaring an extension method, as every bit of documentation describing extension methods will say… –
Jon Skeet

solved DateTime does not contain a defintion for the method and no accessible extension method accepting a first argument of type DateTime could be found [closed]