@@ -106,15 +106,9 @@ public class FormatOptions
106
106
/// <exception cref="ArgumentOutOfRangeException">
107
107
/// <paramref name="value"/> is out of range. It must be between 60 and 998.
108
108
/// </exception>
109
- /// <exception cref="System.InvalidOperationException">
110
- /// <see cref="Default"/> cannot be changed.
111
- /// </exception>
112
109
public int MaxLineLength {
113
110
get { return maxLineLength ; }
114
111
set {
115
- if ( this == Default )
116
- throw new InvalidOperationException ( "The default formatting options cannot be changed." ) ;
117
-
118
112
if ( value < MinimumLineLength || value > MaximumLineLength )
119
113
throw new ArgumentOutOfRangeException ( nameof ( value ) ) ;
120
114
@@ -133,15 +127,9 @@ public int MaxLineLength {
133
127
/// <exception cref="System.ArgumentOutOfRangeException">
134
128
/// <paramref name="value"> is not a valid <see cref="NewLineFormat"/>.</paramref>
135
129
/// </exception>
136
- /// <exception cref="System.InvalidOperationException">
137
- /// <see cref="Default"/> cannot be changed.
138
- /// </exception>
139
130
public NewLineFormat NewLineFormat {
140
131
get { return newLineFormat ; }
141
132
set {
142
- if ( this == Default )
143
- throw new InvalidOperationException ( "The default formatting options cannot be changed." ) ;
144
-
145
133
switch ( newLineFormat ) {
146
134
case NewLineFormat . Unix :
147
135
case NewLineFormat . Dos :
@@ -165,17 +153,9 @@ public NewLineFormat NewLineFormat {
165
153
/// that writing the message back to a stream will always end with a new-line sequence.</para>
166
154
/// </remarks>
167
155
/// <value><c>true</c> in order to ensure that the message will end with a new-line sequence; otherwise, <c>false</c>.</value>
168
- /// <exception cref="System.InvalidOperationException">
169
- /// <see cref="Default"/> cannot be changed.
170
- /// </exception>
171
156
public bool EnsureNewLine {
172
157
get { return ensureNewLine ; }
173
- set {
174
- if ( this == Default )
175
- throw new InvalidOperationException ( "The default formatting options cannot be changed." ) ;
176
-
177
- ensureNewLine = value ;
178
- }
158
+ set { ensureNewLine = value ; }
179
159
}
180
160
181
161
internal IMimeFilter CreateNewLineFilter ( bool ensureNewLine = false )
@@ -229,17 +209,9 @@ public HashSet<HeaderId> HiddenHeaders {
229
209
/// (<a href="https://tools.ietf.org/html/rfc6855">rfc6855</a>).</para>
230
210
/// </remarks>
231
211
/// <value><c>true</c> if the new internationalized formatting should be used; otherwise, <c>false</c>.</value>
232
- /// <exception cref="System.InvalidOperationException">
233
- /// <see cref="Default"/> cannot be changed.
234
- /// </exception>
235
212
public bool International {
236
213
get { return international ; }
237
- set {
238
- if ( this == Default )
239
- throw new InvalidOperationException ( "The default formatting options cannot be changed." ) ;
240
-
241
- international = value ;
242
- }
214
+ set { international = value ; }
243
215
}
244
216
245
217
/// <summary>
@@ -260,12 +232,7 @@ public bool International {
260
232
/// <value><c>true</c> if the formatter should be allowed to use us-ascii and/or iso-8859-1 when encoding headers; otherwise, <c>false</c>.</value>
261
233
public bool AllowMixedHeaderCharsets {
262
234
get { return allowMixedHeaderCharsets ; }
263
- set {
264
- if ( this == Default )
265
- throw new InvalidOperationException ( "The default formatting options cannot be changed." ) ;
266
-
267
- allowMixedHeaderCharsets = value ;
268
- }
235
+ set { allowMixedHeaderCharsets = value ; }
269
236
}
270
237
271
238
/// <summary>
@@ -288,9 +255,6 @@ public bool AllowMixedHeaderCharsets {
288
255
public ParameterEncodingMethod ParameterEncodingMethod {
289
256
get { return parameterEncodingMethod ; }
290
257
set {
291
- if ( this == Default )
292
- throw new InvalidOperationException ( "The default formatting options cannot be changed." ) ;
293
-
294
258
switch ( value ) {
295
259
case ParameterEncodingMethod . Rfc2047 :
296
260
case ParameterEncodingMethod . Rfc2231 :
@@ -315,12 +279,7 @@ public ParameterEncodingMethod ParameterEncodingMethod {
315
279
/// <value><c>true</c> if Content-Type and Content-Disposition parameters should always be quoted; otherwise, <c>false</c>.</value>
316
280
public bool AlwaysQuoteParameterValues {
317
281
get { return alwaysQuoteParameterValues ; }
318
- set {
319
- if ( this == Default )
320
- throw new InvalidOperationException ( "The default formatting options cannot be changed." ) ;
321
-
322
- alwaysQuoteParameterValues = value ;
323
- }
282
+ set { alwaysQuoteParameterValues = value ; }
324
283
}
325
284
326
285
static FormatOptions ( )
0 commit comments