[{"data":1,"prerenderedAt":182},["ShallowReactive",2],{"extension:v3:en:cs":3},{"resolvedFromAlias":4,"canonicalExt":5,"ext":5,"name":6,"category":7,"categoryName":8,"updatedAt":9,"popularity":10,"summary":11,"howToOs":12,"quickAnswer":18,"answerIntro":19,"whatIs":20,"description":21,"furtherReading":22,"openInstructions":41,"commonIssues":55,"securityNotes":74,"faq":78,"aliases":88,"mimeTypes":89,"relatedExtensions":91,"breadcrumbs":139,"categoryAnchor":149,"categoryFuturePath":150,"metaDescription":151,"availableHowToOs":152,"openOnDeviceLinks":153,"cannotOpenReasons":169,"cannotOpenFixes":170,"convertOptions":171,"securityAffiliateMessaging":172,"securityAffiliates":173},false,"cs","C# source code file","code","Code","2026-06-12T09:03:13.752Z",80,".cs files contain C# source code used to build .NET applications and libraries. They are plain-text files typically edited in code editors and IDEs such as Visual Studio Code with C# tooling.",[13,14,15,16,17],"windows","mac","linux","ios","android","To open .CS files on Windows, right-click the .cs file and choose “Open with…”.","To open a .cs file, use a source-code editor (for example, Visual Studio Code). On Linux desktops, .cs is commonly identified as “C# source code” (MIME type text/x-csharp).","A .cs file is a plain-text source file written in the C# programming language. The shared-mime-info database maps *.cs to the MIME type text/x-csharp with the description “C# source code”, which helps Linux desktops pick an appropriate editor. C# itself is standardized (ECMA-334) and .cs is the conventional extension used for C# code files.","C# is a general-purpose, object-oriented programming language, and .cs is its common source file extension. You’ll see .cs files in everything from small console examples (for example, hello-world.cs) to multi-file applications.",[23,26,29,32,35,38],{"title":24,"url":25},"shared-mime-info: freedesktop.org.xml.in (defines text/x-csharp for *.cs)","https://cgit.freedesktop.org/xdg/shared-mime-info/tree/data/freedesktop.org.xml.in",{"title":27,"url":28},"Shared MIME-info Database Specification (how globs and MIME types are distributed)","https://specifications.freedesktop.org/shared-mime-info-spec/latest-single/",{"title":30,"url":31},"Working with C# in Visual Studio Code","https://code.visualstudio.com/docs/languages/csharp",{"title":33,"url":34},"General structure of a C# program (example uses hello-world.cs)","https://learn.microsoft.com/da-dk/dotnet/csharp/fundamentals/program-structure/",{"title":36,"url":37},"Build file-based apps (example uses AsciiArt.cs)","https://learn.microsoft.com/en-au/dotnet/csharp/fundamentals/tutorials/file-based-programs",{"title":39,"url":40},"ECMA-334 C# language specification","https://ecma-international.org/publications-and-standards/standards/ecma-334/",{"windows":42,"macos":45,"linux":48,"ios":51,"android":53},[43,44],"Right-click the .cs file and choose “Open with…”.","Select Visual Studio Code (or another code editor you already trust) and open the file as text.",[46,47],"Control-click the .cs file and choose “Open With”.","Open it in Visual Studio Code (or another text/code editor) so you can view and edit it safely as plain text.",[49,50],"Double-click the .cs file in your file manager; it is typically recognized as “C# source code” (text/x-csharp).","If prompted, choose a code editor (for example, Visual Studio Code).",[52],".cs files are source code; for reliable editing and building, transfer the file to a desktop and open it in a code editor such as Visual Studio Code.",[54],".cs files are source code; for full tooling and project builds, move the file to a desktop and open it in a code editor such as Visual Studio Code.",[56,62,68],{"title":57,"description":58,"steps":59},"Double-clicking opens the wrong app (or shows as an unknown type)","If file associations are misconfigured, your system may open .cs in an unsuitable program or not know what it is. On Linux, correct identification typically comes from the shared-mime-info mapping (*.cs → text/x-csharp).",[60,61],"Use “Open with…” and pick a code editor (such as Visual Studio Code).","If you’re on Linux and file type detection seems wrong, check that your system’s shared-mime-info database is up to date and that the file still has the .cs extension.",{"title":63,"description":64,"steps":65},"VS Code prompts to install C# tooling when opening the file","Visual Studio Code can detect C# files and may prompt you to install C# support to provide features like IntelliSense and debugging.",[66,67],"Follow the prompt in VS Code to install the recommended C# tooling for C# development.","Reopen the folder/project containing the .cs file so VS Code can load the C# features correctly.",{"title":69,"description":70,"steps":71},"Code examples don’t run by just opening the .cs file","A .cs file is source code; it typically needs to be compiled/run within a proper C# workflow rather than “opened” like a document.",[72,73],"Use a C# tutorial workflow that creates and runs file-based programs (for example, create a file like AsciiArt.cs and run it as instructed).","Ensure the file is part of the intended program context (for example, the correct folder/project) before trying to execute it.",[75,76,77],".cs files are plain text, but they can contain code that performs harmful actions if you compile and run it; treat untrusted .cs files like any other untrusted source code.","Be especially cautious with .cs files that include build/run instructions or scripts in accompanying documentation—review the code before executing any commands.","Editor/IDE extensions that add C# tooling run additional components and analyzers; only install C# tooling from sources you trust when prompted by your editor.",[79,82,85],{"question":80,"answer":81},"Is a .cs file the same as a compiled program?","No. A .cs file is C# source code. It must be compiled (usually as part of a project) to produce runnable outputs.",{"question":83,"answer":84},"What does Linux usually call this file type?","Many Linux desktops use shared-mime-info, which maps *.cs to the MIME type text/x-csharp with the description “C# source code”.",{"question":86,"answer":87},"Why does VS Code ask me to install something when I open a .cs file?","VS Code can detect C# files and may prompt you to install C# support so it can provide language features like IntelliSense and debugging.",[],[90],"text/x-csharp",[92,98,103,109,115,121,127,133],{"ext":93,"name":94,"category":7,"categoryName":8,"popularity":95,"summary":96,"howToOs":97},"php","PHP script (PHP source code)",85,".php files typically contain PHP source code used on web servers to generate dynamic web pages and API responses. You can open them in a code editor, but they are usually executed by a web server (often via PHP-FPM) rather than “run” like a normal desktop app.",[13,14,15,16,17],{"ext":99,"name":100,"category":7,"categoryName":8,"popularity":95,"summary":101,"howToOs":102},"sql","SQL script (Structured Query Language)",".sql files contain SQL statements (queries, schema definitions, and data changes) that can be run by a database tool or opened as plain text for review and editing.",[13,14,15,16,17],{"ext":104,"name":105,"category":7,"categoryName":8,"popularity":106,"summary":107,"howToOs":108},"go","Go source file",78,".go files contain source code written in the Go (Golang) programming language. You can open them in code editors (for reading/editing) or build/run them with the Go toolchain.",[13,14,15,16,17],{"ext":110,"name":111,"category":7,"categoryName":8,"popularity":112,"summary":113,"howToOs":114},"tsx","TypeScript JSX (TSX) source file",75,".tsx is a TypeScript source code file that contains JSX syntax, commonly used with React-style UI components. You open it in a code editor (for viewing/editing) and build it with TypeScript tooling (for running in apps).",[13,14,15,16,17],{"ext":116,"name":117,"category":7,"categoryName":8,"popularity":118,"summary":119,"howToOs":120},"kt","Kotlin source file",72,".kt files contain Kotlin source code used to build Kotlin applications (including Android apps) and libraries. You typically open them in a code editor or IDE such as IntelliJ IDEA or Android Studio.",[13,14,15,16,17],{"ext":122,"name":123,"category":7,"categoryName":8,"popularity":124,"summary":125,"howToOs":126},"swift","Swift Source Code",70,".swift is a Swift programming language source file used to write apps and other software. You open it in code editors and IDEs such as Xcode or other text/code editors.",[13,14,15,16,17],{"ext":128,"name":129,"category":7,"categoryName":8,"popularity":130,"summary":131,"howToOs":132},"dart","Dart source code",65,".dart files contain source code written in the Dart programming language. You open them in a code editor/IDE or work with them using the Dart SDK tools.",[13,14,15,16,17],{"ext":134,"name":135,"category":7,"categoryName":8,"popularity":136,"summary":137,"howToOs":138},"proto","Protocol Buffers schema (Protocol Buffers definition file)",60,".proto files define data structures and services for Google’s Protocol Buffers. They are plain-text schemas that you open in a text editor/IDE or compile with the Protocol Buffers compiler (protoc) to generate code.",[13,14,15,16,17],[140,143,146],{"label":141,"to":142},"Home","/",{"label":144,"to":145},"File Extension Index","/file-extension",{"label":147,"to":148},".CS","/file-extension/cs","category-code","/category/code","Learn what .CS files are, how to open them on every platform, common fixes, and security best practices.",[13,14,15,16,17],[154,157,160,163,166],{"os":13,"label":155,"to":156},"Open .CS on Windows","/how-to/open-cs-on-windows",{"os":14,"label":158,"to":159},"Open .CS on Mac","/how-to/open-cs-on-mac",{"os":15,"label":161,"to":162},"Open .CS on Linux","/how-to/open-cs-on-linux",{"os":16,"label":164,"to":165},"Open .CS on iOS","/how-to/open-cs-on-ios",{"os":17,"label":167,"to":168},"Open .CS on Android","/how-to/open-cs-on-android",[57,63,69],[60,61],[],"code_runtime",[174,178],{"name":175,"description":176,"affiliateUrl":177},"Avast","Avast offers free and premium antivirus software that protects against viruses, malware, ransomware, and phishing. Scan files before opening them to ensure safety.","https://www.avast.com/lp-aff-consumer-store?expid=inf601",{"name":179,"description":180,"affiliateUrl":181},"Norton","Norton 360 delivers comprehensive antivirus protection, VPN, and identity theft monitoring. Scan files for threats before opening to keep your device secure.","http://buy.norton.com/aff_home?utm_campaign=en-ww_nor_n36_aff_nas_nau_nah_cj_nad_low:_sec_nat_mktc_norton_360",1781269501292]