Version of C# - print in a program

Posted by Gayathri under C# on 12/3/2010 | Points: 10 | Views : 2024 | Status : [Member] | Replies : 2
Is there any method or property to display the version of C# ?




Responses

Posted by: SheoNarayan on: 12/3/2010 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
I think there is not such direct way to get C# version (at least I didn't find), however you can determine the .NET Framework version and conclude the C# version.

To know the .NET Framework version, write following code

string s = Environment.Version.ToString();


There are other property of Version as well to know the major and minor version of the .NET Framework.
Once you have the .NET Framework version you can determine the C# version based on following

.NET Framework 2 - C# 2
.NET Framework 3 - C# 2
.NET Framework 3.5 - C# 3
.NET Framework 4 - C# 4

To know more about version class, read this http://msdn.microsoft.com/en-us/library/system.version.aspx

Thanks!


Regards,
Sheo Narayan
http://www.dotnetfunda.com

Gayathri, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gayathri on: 12/3/2010 [Member] Starter | Points: 25

Up
0
Down
Great! Thanks


-Gayathri

Gayathri, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response