Updates referencesource to .NET 4.7
[mono.git] / mcs / class / referencesource / mscorlib / system / security / principal / identityreference.cs
1 // ==++==
2 // 
3 //   Copyright (c) Microsoft Corporation.  All rights reserved.
4 // 
5 // ==--==
6 // <OWNER>Microsoft</OWNER>
7 // 
8
9 using System;
10 using System.Security.Policy; // defines Url class
11 using System.Globalization;
12 using System.Diagnostics.Contracts;
13
14 namespace System.Security.Principal
15 {
16 [System.Runtime.InteropServices.ComVisible(false)]
17     public abstract class IdentityReference
18     {
19         internal IdentityReference()
20         {
21             // exists to prevent creation user-derived classes (for now)
22         }
23         
24 //      public abstract string Scheme { get; }
25
26         public abstract string Value { get; }
27
28 //      public virtual Url Url
29 //      {
30 //          get { return new Url(""); } // 
31
32
33         public abstract bool IsValidTargetType( Type targetType );
34
35         public abstract IdentityReference Translate( Type targetType );
36
37         public override abstract bool Equals( object o );
38
39         public override abstract int GetHashCode();
40
41         public override abstract string ToString();
42
43         public static bool operator==( IdentityReference left, IdentityReference right )
44         {
45             object l = left;
46             object r = right;
47
48             if ( l == null && r == null )
49             {
50                 return true;
51             }
52             else if ( l == null || r == null )
53             {
54                 return false;
55             }
56             else
57             {
58                 return left.Equals( right );
59             }
60         }
61
62         public static bool operator!=( IdentityReference left, IdentityReference right )
63         {
64             return !( left == right ); // invoke operator==
65         }
66     }
67 }