473,396 Members | 1,879 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,396 software developers and data experts.

bool or Boolean?

Hello,

When using C# should I use bool or Boolean, string or String, ... do
define a variable?

I am used to VB but for a few months I have been using C# instead ...

Thanks,
Miguel
Aug 20 '08 #1
2 1848
shapper wrote:
>
When using C# should I use bool or Boolean, string or String, ... do
define a variable?

I am used to VB but for a few months I have been using C# instead ...
Matter of style.

Personally I prefer bool/string over Boolean/String. It is my impression
that the majority does the same.

Note that for method names like writeXxxx then you should always use
the .NET names, because the code may be used from other languages.

Arne
Aug 20 '08 #2
It is considered standard to use bool instead of Boolean, string
instead of String, etc.
But technically, it's the same thing because they are all just
aliases.
int is an alias for Int32, string points to String, etc.

I you are going to be writing code in different languages (like C# and
VB) on a regular basis, it's best to be consistent, but I personally
like to use aliases, because who would want to type out Int64 instead
of long every time you need to use it???
On Aug 20, 4:27 pm, Arne Vajhøj <a...@vajhoej.dkwrote:
shapper wrote:
When using C# should I use bool or Boolean, string or String, ... do
define a variable?
I am used to VB but for a few months I have been using C# instead ...

Matter of style.

Personally I prefer bool/string over Boolean/String. It is my impression
that the majority does the same.

Note that for method names like writeXxxx then you should always use
the .NET names, because the code may be used from other languages.

Arne
Aug 21 '08 #3

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

Similar topics

14
by: JKop | last post by:
Will the following print "NOT equal" on all implementations: #include <iostream> signed main() { bool k; k = 5;
19
by: daniel | last post by:
1) is C++ smart enough to automatically use "bits" for bool or will a bool have the size of a charcter (byte). 2) The index of a vector is it an integer (4 byte) or a "long long" with 8 bytes or...
16
by: raj | last post by:
Hi, I saw it mentioned that "int" is the fastest data-type for use in C ,that is data storage/retrieval would be the fastest if I use int among the following 4 situations in a 32 bit machine with...
0
by: Stanislav Simicek | last post by:
Hello, I've noticed that MC++ compiler (VS.NET 2003) marks "bool" type with MarshalAs(UnmanagedType.U1) attribute, even if System::Boolean is used. I would understand, why this happens for C++...
2
by: HL | last post by:
I am using VS2005 Beta2 In the VS.NET IDE, the Intellisense drop-down shows both bool and Boolean. What is the difference between the two? Similarly, it shows string and String ('s'...
6
by: zl2k | last post by:
hi, there I am using a big, sparse binary array (size of 256^3). The size may be changed in run time. I first thought about using the bitset but found its size is unchangeable. If I use the...
64
by: shaanxxx | last post by:
I have code which says #define MYBOOL int This code is very old. people who have written is not avaible. I was thinking what could be reason. 1) bool datatype was not available that time (10...
23
by: Saizan | last post by:
Why subclassing bool from int either __invert__ or __neg__ haven't been overrided to produce a boolean negation? I suspect backwards compatibility or something alike, but I still wonder.. And...
12
by: aaragon | last post by:
Hi All, I'm trying to print boolean values and after I searched the entire web, I couldn't find anything that does this =/ The code that I ended up using is as follows: string...
51
by: AommiK | last post by:
First of all: I love C and think that it's beautiful. However, there is at least one MAJOR flaw: the lack of a boolean type. OK. Some of you might refer to C99 and its _Bool (what's up with the...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.