Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Semrush - keyword research tool

Create your online store today with Shopify

Turn ChatGPT, Claude, Gemini, And CoPilot Into Your Personal Assistant, Business Coach, Content Creator, And More

AFFILIATE MARKETING Your all-in-one performance engine Manage affiliates, creators, and customer referrals in one unified platform—turning every partnership into measurable growth

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Disclosure: My content contains affiliate links.

43,239 questions

56,142 answers

573 users

How to get the current OS name and version in C#

1 Answer

0 votes
using System;
using System.Runtime.InteropServices;

class Program
{
    static void Main()
    {
        // Get the OS description (e.g., Windows, Linux, macOS)
        string osDescription = RuntimeInformation.OSDescription;

        // Get the OS architecture (e.g., x64, ARM)
        string osArchitecture = RuntimeInformation.OSArchitecture.ToString();

        Console.WriteLine($"Operating System: {osDescription}");
        Console.WriteLine($"Architecture: {osArchitecture}");
    }
}


 
/*
run:
     
Operating System: Unix 6.6.72.0
Architecture: X64
 
*/

 



answered Mar 27, 2025 by avibootz

Related questions

1 answer 151 views
1 answer 168 views
1 answer 160 views
1 answer 164 views
1 answer 181 views
1 answer 126 views
1 answer 147 views
...