Skip to content

Instantly share code, notes, and snippets.

@tritao
Created May 29, 2014 11:14
Show Gist options
  • Save tritao/a775ba9daa3ccbd79423 to your computer and use it in GitHub Desktop.
Save tritao/a775ba9daa3ccbd79423 to your computer and use it in GitHub Desktop.
Difference in behavior from MS and Mono's C# compilers
/**
C:\Development>mcs dev.cs
dev.cs(8,18): warning CS0649: Field `WindowsIdentity._type' is never assigned to, and will always have its default value `null'
Compilation succeeded - 1 warning(s)
C:\Development>csc /nologo dev.cs
dev.cs(14,17): error CS0546: 'WindowsIdentity.AuthenticationType.set': cannot override because 'ClaimsIdentity.AuthenticationType' does not have an
overridable set accessor
dev.cs(3,24): (Location of symbol related to previous error)
*/
public class ClaimsIdentity
{
public virtual string AuthenticationType { get; private set; }
}
public class WindowsIdentity : ClaimsIdentity
{
private string _type;
// properties
//#if NET_4_5
sealed override
//#endif
public string AuthenticationType {
get { return _type; }
}
}
public class Program
{
public static void Main()
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment