473,387 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

default value of type

I would like to know if there is a list for default values of types (e.g.
int, float, bool, System.Drawing.Color, String, etc)?
Thanks.

--
Franz Wong
My C++ and C# Site (Traditional Chinese) : http://www.franzwong.com

Nov 15 '05 #1
3 1702
Franz wrote:
|| I would like to know if there is a list for default values of types
|| (e.g. int, float, bool, System.Drawing.Color, String, etc)?
|| Thanks.
||
|| --
|| Franz Wong
|| My C++ and C# Site (Traditional Chinese) : http://www.franzwong.com

Check the : "Default Values Table" in the C# reference manual, for the built-in types.
There is no list of default values for FCL types, you should inspect each type independently.
f.i System.Drawing.Color has [Empty] default see Description of System.Drawing.Color.

Willy.
Nov 15 '05 #2
Franz wrote:
|| Thank you first.
|| For System.Drawing.Color, I know that Empty is the default value.
|| But I can't find that in the MSDN reference.
||
|| --
|| Franz Wong
|| My C++ and C# Site (Traditional Chinese) : http://www.franzwong.com
||

That's right, but if you take a look at the description of IsEmpty, it certainly contains a hint :-).

Willy.
Nov 15 '05 #3
Hi!

Reference types are set to null by the CLR and valuetypes to zero (Except
for bool which is set to false).

--

Regards,
Gaurav Khanna
----------------------------------------------------------------------------
----------------
Microsoft MVP - .NET, MCSE Windows 2000/NT4, MCP+I
WinToolZone - Spelunking Microsoft Technologies
http://www.wintoolzone.com/
"Franz" <ho******@yahoo.com.hk> wrote in message
news:Or**************@tk2msftngp13.phx.gbl...
I would like to know if there is a list for default values of types (e.g.
int, float, bool, System.Drawing.Color, String, etc)?
Thanks.

--
Franz Wong
My C++ and C# Site (Traditional Chinese) : http://www.franzwong.com

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

29
by: John Wood | last post by:
Even though CSC does its best to detect use of unassigned variables, it often misses it... for example if you just declare a double in a class without assigning a default value, it has a default...
74
by: Zytan | last post by:
I have a struct constructor to initialize all of my private (or public readonly) fields. There still exists the default constructor that sets them all to zero. Is there a way to remove the...
4
by: Jess | last post by:
Hello, I tried several books to find out the details of object initialization. Unfortunately, I'm still confused by two specific concepts, namely default-initialization and...
4
by: Macneed | last post by:
i am a newbie, i remember i read a book talking about when u declare a array variable using float ABC = new float; the whole array element in ABC ( ABC to ABC ) will automatic initialize to 0...
2
by: harichinna | last post by:
Hi to all, My name is hari, iam trying to delete the column value of spread sheet using c sharp, iam trying to get the value and compare, when comparing it showing some errors, can any one help...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.