mscorlib(4.0.0.0) API with additions
DecoderReplacementFallback.cs
1 namespace System.Text
2 {
5  [__DynamicallyInvokable]
7  {
8  private string strDefault;
9 
12  [__DynamicallyInvokable]
13  public string DefaultString
14  {
15  [__DynamicallyInvokable]
16  get
17  {
18  return strDefault;
19  }
20  }
21 
24  [__DynamicallyInvokable]
25  public override int MaxCharCount
26  {
27  [__DynamicallyInvokable]
28  get
29  {
30  return strDefault.Length;
31  }
32  }
33 
35  [__DynamicallyInvokable]
37  : this("?")
38  {
39  }
40 
47  [__DynamicallyInvokable]
48  public DecoderReplacementFallback(string replacement)
49  {
50  if (replacement == null)
51  {
52  throw new ArgumentNullException("replacement");
53  }
54  bool flag = false;
55  for (int i = 0; i < replacement.Length; i++)
56  {
57  if (char.IsSurrogate(replacement, i))
58  {
59  if (char.IsHighSurrogate(replacement, i))
60  {
61  if (flag)
62  {
63  break;
64  }
65  flag = true;
66  continue;
67  }
68  if (!flag)
69  {
70  flag = true;
71  break;
72  }
73  flag = false;
74  }
75  else if (flag)
76  {
77  break;
78  }
79  }
80  if (flag)
81  {
82  throw new ArgumentException(Environment.GetResourceString("Argument_InvalidCharSequenceNoIndex", "replacement"));
83  }
84  strDefault = replacement;
85  }
86 
89  [__DynamicallyInvokable]
91  {
92  return new DecoderReplacementFallbackBuffer(this);
93  }
94 
99  [__DynamicallyInvokable]
100  public override bool Equals(object value)
101  {
102  DecoderReplacementFallback decoderReplacementFallback = value as DecoderReplacementFallback;
103  if (decoderReplacementFallback != null)
104  {
105  return strDefault == decoderReplacementFallback.strDefault;
106  }
107  return false;
108  }
109 
112  [__DynamicallyInvokable]
113  public override int GetHashCode()
114  {
115  return strDefault.GetHashCode();
116  }
117  }
118 }
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
Provides a failure-handling mechanism, called a fallback, for an encoded input byte sequence that can...
Represents a substitute output string that is emitted when the original input byte sequence cannot be...
override int GetHashCode()
Retrieves the hash code for the value of the T:System.Text.DecoderReplacementFallback object.
string DefaultString
Gets the replacement string that is the value of the T:System.Text.DecoderReplacementFallback object.
override DecoderFallbackBuffer CreateFallbackBuffer()
Creates a T:System.Text.DecoderFallbackBuffer object that is initialized with the replacement string ...
Provides information about, and means to manipulate, the current environment and platform....
Definition: Environment.cs:21
Provides a buffer that allows a fallback handler to return an alternate string to a decoder when it c...
override int MaxCharCount
Gets the number of characters in the replacement string for the T:System.Text.DecoderReplacementFallb...
DecoderReplacementFallback(string replacement)
Initializes a new instance of the T:System.Text.DecoderReplacementFallback class using a specified re...
Provides a failure-handling mechanism, called a fallback, for an encoded input byte sequence that can...
override bool Equals(object value)
Indicates whether the value of a specified object is equal to the T:System.Text.DecoderReplacementFal...
The exception that is thrown when one of the arguments provided to a method is not valid.
Specifies that the class can be serialized.
DecoderReplacementFallback()
Initializes a new instance of the T:System.Text.DecoderReplacementFallback class.