AppVersion Struct & VersionParse Exception
I am working on an app that will interact with assembly (app) versions


There's a class, System.Version, that might be suitable for your needs. System.Version:


  Represents the version number of an assembly, operating system, or the common language runtime.


It has Major, Minor, Build, and Revision properties.

If you still want to roll your own, my advice is to


Make AppVersion immutable
Be stricter about the values you allow
Implement IEquatable&lt;AppVersion&gt;
Consider implementing IComparable&lt;AppVersion&gt;




In general, you should avoid mutable structs.

From MSDN


  X DO NOT define mutable value types.
  
  Mutable value types have several problems. For example, when a property getter returns a value type, the caller receives a copy. Because the copy is created implicitly, developers might not be aware that they are mutating the copy, and not the original value.


See also: Why are mutable structs “evil”?



With the code as written, this works just fine:

appVersion.Version = "   +123 . -4236 . +0 . -789";


Use the overloads of int.Parse/int.TryParse that take a NumberStyles argument. If you provide constructors as suggested below, check that the values passed in are non-negative.



From MSDN


  ✓ DO implement IEquatable&lt;T&gt; on value types.
  
  The Object.Equals method on value types causes boxing, and its default implementation is not very efficient, because it uses reflection. Equals can have much better performance and can be implemented so that it will not cause boxing.




I find it hard to imagine not ever wanting to compare app versions, so you will probably want to implement IComparable&lt;AppVersion&gt;.



I would recommending getting rid of the Version property entirely. Instead, provide one or more constructors like

public AppVersion(int majorVersion, int minorVersion)

public AppVersion(int majorVersion, int minorVersion, int buildNumber)

...


and then provide static methods AppVersion Parse(string) and bool TryParse(string, out AppVersion).



Also, you should be aware of the existence of auto-implemented properties.