"As you can see, I still don't know how to write it so it isn't expecting a parameter, so I've assigned the string to be returned in the "Public Static" line, is that the way around this ? However, I am having trouble picking it up, I'm obviously doing something wrong, but I've tried to do the same as the MSDN example but when I code ... string myWinVer = MyWindowsVersion.WindowsVersion("x"); ... I get an error "'MyWindowsVersion.WindowsVersion' is a 'type', which is not valid in the given context"
I think that you are making this waaaaaaaaaaaaay to hard on yourself.
If you do not what to pass any parameters in, then simply don't. Change your function declaration to:
public static string add()
Probably the easiest thing for you to do is to have a local string variable for the os name then the rest of your code should be okay as is.
string myStr = Environment.OSVersion.Version.ToString();
string myOSname;
int myOSver = int.Parse(myStr.Substring(0,1));
The other part of your problem is the calling convention. In your example, "WindowsVersion" is the name of the class. You got that error because you did not tell it to call a function. From your calling function you would:
string version = MyWindowsVersion.WindowsVersion.add();
Of course changing the function name to something more appropriate, like GetOsName or similar, couldn't hurt.