TextText-based

text/x-csharp

C# Source

Reference for text/x-csharp, the MIME type for C# programming language source files used in .NET development.

MIME Type Detector

Drop a file to detect its MIME type — no upload, runs in your browser

📄

Drop any file here or click to choose

Expected extensions: .cs

HTTP Content-Type Header

HTTP Header
Content-Type: text/x-csharp; charset=utf-8

Associated File Extensions

.cs

Quick Facts

MIME Typetext/x-csharp
CategoryText
TypeText-based (human-readable)
Extensions.cs

Common Usage

C# source files are used for .NET applications, Unity game development, Windows desktop applications, ASP.NET web services, Azure cloud functions, and cross-platform mobile apps with MAUI. C# is one of the most popular languages for enterprise development.

Code Examples

HTML
<!-- Link or embed with explicit type -->
<link rel="stylesheet" href="file.cs" type="text/x-csharp">

<!-- Or for script/media elements -->
<script type="text/x-csharp" src="file.cs"></script>
Node.js
// Express.js
app.get('/file', (req, res) => {
  res.type('text/x-csharp');
  res.send(data);
});

// Node.js http
res.writeHead(200, { 'Content-Type': 'text/x-csharp' });
nginx
# nginx.conf — add to types block or use default
types {
    text/x-csharp  cs;
}

# Or set for a specific location
location /api/ {
    default_type text/x-csharp;
}

Related MIME Types

More Text MIME Types

Other text types in the Text family

Related Tools

Explore More MIME Types

Browse our complete reference of 185 MIME types with usage examples, HTTP headers, and code snippets.