Will the following code compile?
 
public class CustomConvertor 
{ 
     public static string ToDate(out this DateTime dt) 
     { 
           return dt.ToShortDateString(); 
     } 
}
 
Explanation
No, it will not
1. Class that contains extension methods must be static.
2. Modifier "out" in the declaration of extension methods is not necassary.

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты