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.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes