UpdateCheck GetNewerVersion Method CleanCode C# Libraries v1.2.03 API
Gets the newer version if available and within the checking frequency.

Namespace: CleanCode.IO
Assembly: CleanCode (in CleanCode.dll) Version: (1.2.03)

public string GetNewerVersion(
	int days,
	DateTime lastChecked


Type: OnlineSystem Int32
The frequency to check, in days. Zero indicates to always check.
Type: OnlineSystem DateTime
The last checked date.

Return Value

Newer version number or null.

Similar to RemindNewerVersion(Int32, DateTime), this checks for the presence of a newer release, returning that release number for the calling code to handle. Here is an example detailing the use of this method:
UpdateCheck updateCheck = new UpdateCheck(
    Assembly.GetExecutingAssembly(), REPOSITORY, PROG_PATTERN);
DateTime lastUpdateCheck = Properties.Settings.Default.UpdateChecked;
string newVer = 
    updateCheck.GetNewerVersion(UPDATE_REMINDER_FREQUENCY, lastUpdateCheck);
if (newVer != null)
        "newer version " + newVer + " available -- please upgrade");
    Properties.Settings.Default.UpdateChecked = DateTime.Now.Date;
This sample illustrates a use case where the calling program wishes to notify the user every 2 days, rather than every time the application is launched. The last time checked is stored in a user's persistent settings.
See Also