@@ -12,7 +12,10 @@ public class PostalCodeRange : IEquatable<PostalCodeRange>, IComparable<PostalCo
1212 /// The lazy default
1313 /// </summary>
1414 private static readonly Lazy < PostalCodeRange > LazyDefault = new Lazy < PostalCodeRange > ( ( ) => new PostalCodeRange ( null , null ) ) ;
15-
15+
16+ private PostalCode _start ;
17+ private PostalCode _end ;
18+
1619 /// <summary>
1720 /// Gets the default.
1821 /// </summary>
@@ -43,8 +46,8 @@ public PostalCodeRange(PostalCode start, PostalCode end)
4346 "PostalCodeRange end ({0}) can't be before start ({1})" , end , start ) ) ;
4447 }
4548
46- Start = start != null ? start . ExpandPostalCodeAsLowestInRange ( ) : start ;
47- End = end != null ? end . ExpandPostalCodeAsHighestInRange ( ) : end ;
49+ _start = start != null ? start . ExpandPostalCodeAsLowestInRange ( ) : null ;
50+ _end = end != null ? end . ExpandPostalCodeAsHighestInRange ( ) : null ;
4851 }
4952
5053 /// <summary>
@@ -69,13 +72,21 @@ public bool IsDefault
6972 /// Gets the start.
7073 /// </summary>
7174 /// <value>The start.</value>
72- public PostalCode Start { get ; private set ; }
75+ public PostalCode Start
76+ {
77+ get { return _start ; }
78+ set { _start = value != null ? value . ExpandPostalCodeAsLowestInRange ( ) : null ; }
79+ }
7380
7481 /// <summary>
7582 /// Gets the end.
7683 /// </summary>
7784 /// <value>The end.</value>
78- public PostalCode End { get ; private set ; }
85+ public PostalCode End
86+ {
87+ get { return _end ; }
88+ set { _end = value != null ? value . ExpandPostalCodeAsHighestInRange ( ) : null ; }
89+ }
7990
8091 /// <summary>
8192 /// Gets the predecessor postal code.
@@ -346,8 +357,9 @@ public static bool Contains(PostalCodeRange range, PostalCode specificCode)
346357 {
347358 return false ;
348359 }
349- return range . IsDefault
350- || ( ( range . Start <= specificCode ) && ( specificCode <= range . End ) ) ;
360+
361+ return range . IsDefault ||
362+ ( ( range . Start <= specificCode . ExpandPostalCodeAsLowestInRange ( ) ) && ( specificCode . ExpandPostalCodeAsHighestInRange ( ) <= range . End ) ) ;
351363 }
352364
353365 /// <summary>
0 commit comments