Web Design that taps into the haromny and vision of your dreams.

C# Data Types and Value Ranges

The major data types in C#

Written By on in C#

168 words, estimated reading time 1 minutes.

Like most modern programming languages, C# supports all the major data types and a whole load more. This page lists the most common types and the ranges/lengths of values they can hold.

This article relates to an old version of the .Net Framework. While the contents are still relevant, future versions of the framework may change, or improve upon, the contents of this article.

All minimum and maximum values can be found using (data type).MinValue and (data type).MaxValue (e.g. int.MinValue).

bool1Named literalfalsetrue
sbyte1Signed byte-128127
byte1Unsigned byte0255
short2Signed short integer-3276832767
ushort2Unsigned short065535
int4Signed integer-21474836482147483647
uint4Unsigned integer04294967295
long8Signed long int-9.2233E+189.2233E+18
ulong8Unsigned long int018446E+19
char2Unicode character, contained within single quotes.0128a,b,4
float4floating point-3.402823E+383.402823E+383.14159
double8Floating point-1.7976931E+3081.7976931E+3083.14159
decimal16Floating point, accurate to the 28th decimal place.-7.9228E+247.9228E+24
object8+Base type for all other typesn/an/an/a
string20+Immutable character arrayn/an/a"Hello World"
DateTime8Represents an instant in time, typically expressed as a date and time of day.00:00:00 01/01/000123:59:59 31/12/999914:289:35 08/05/2010

Last updated on: Friday 8th September 2017



There are no comments for this post. Be the first!


Leave a Reply

Your email address will not be published.

If you find something abusive or that does not comply with our terms or guidelines please flag it as inappropriate.

Copyright © 2001-2018 Tim Trott, all rights reserved. Web Design by Azulia Designs

This web page is licensed for your personal, private, non-commercial use only.

Disclaimer, Privacy & LegalSitemapContact Me