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

or Read more about C# Quiz

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback