Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
The struct should probably also implement IEquatable and IComparable (+their generic counterparts, for string and NonEmptyString both), and IEnumerable+IEnumerable<char> too, for almost-complete parity with a string.
The struct should probably also implement IEquatable and IComparable (+their generic counterparts, for string and NonEmptyString both), and IEnumerable+IEnumerable<char> too, for almost-complete parity with a string.
The try/catch is superfluous, a guard clause should be throwing before the constructor is even invoked IMO; the exception could be an ArgumentNullException, but that would be confusing if value was actually string.Empty. Or evenPerhaps derive a custom exception from ArgumentException:
The try/catch is superfluous, a guard clause should be throwing before the constructor is even invoked IMO; the exception could be an ArgumentNullException, but that would be confusing if value was actually string.Empty. Or even derive a custom exception from ArgumentException:
The try/catch is superfluous, a guard clause should be throwing before the constructor is even invoked IMO; the exception could be an ArgumentNullException, but that would be confusing if value was actually string.Empty. Perhaps derive a custom exception from ArgumentException: