Hi
What is the difference by using String myString or string myString when
declaring a string ?
Regards
Martin 11 2823
None.
'string' is an alias for the 'String' class. Just as 'int' is an alias for
the Int32 structure, and so on.
"Martin Arvidsson" <ye*******@ms.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hi
What is the difference by using String myString or string myString when
declaring a string ?
Regards
Martin
Is there a benefit to using one over the other? I've sometimes found
myself wondering if I should declare all my int's as Int32's.
On Nov 8, 4:18 pm, "Marina Levit [MVP]" <some...@nospam.comwrote:
None.
'string' is an alias for the 'String' class. Just as 'int' is an alias for
the Int32 structure, and so on.
"Martin Arvidsson" <yeahri...@ms.comwrote in messagenews:%2****************@TK2MSFTNGP03.phx.gb l...
Hi
What is the difference by using String myString or string myString when
declaring a string ?
Regards
Martin- Hide quoted text -- Show quoted text -
No, I am fairly certain the compiler knows to translate one to the other.
<gb****@gmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
Is there a benefit to using one over the other? I've sometimes found
myself wondering if I should declare all my int's as Int32's.
On Nov 8, 4:18 pm, "Marina Levit [MVP]" <some...@nospam.comwrote:
>None.
'string' is an alias for the 'String' class. Just as 'int' is an alias for the Int32 structure, and so on.
"Martin Arvidsson" <yeahri...@ms.comwrote in messagenews:%2****************@TK2MSFTNGP03.phx.g bl...
Hi
What is the difference by using String myString or string myString when
declaring a string ?
Regards
Martin- Hide quoted text -- Show quoted text -
int is mapped to System.Int32 so other then typing more you won't accomplish
much :)
Regards,
John
<gb****@gmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
Is there a benefit to using one over the other? I've sometimes found
myself wondering if I should declare all my int's as Int32's.
On Nov 8, 4:18 pm, "Marina Levit [MVP]" <some...@nospam.comwrote:
>None.
'string' is an alias for the 'String' class. Just as 'int' is an alias for the Int32 structure, and so on.
"Martin Arvidsson" <yeahri...@ms.comwrote in messagenews:%2****************@TK2MSFTNGP03.phx.g bl...
Hi
What is the difference by using String myString or string myString when
declaring a string ?
Regards
Martin- Hide quoted text -- Show quoted text -
<gb****@gmail.comwrote:
Is there a benefit to using one over the other? I've sometimes found
myself wondering if I should declare all my int's as Int32's.
I use the keyword names in my code for the sake of keyword higlighting
- but for library methods, you should use the type name (eg
Convert.ToInt32) so that it's not tailored to one particular .NET
language.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
That's sound advice. Is that the reason these aliases exist in C#? To
provide a way to refer to objects in a non-language specific way?
On Nov 8, 5:11 pm, Jon Skeet [C# MVP] <s...@pobox.comwrote:
<gbg...@gmail.comwrote:
Is there a benefit to using one over the other? I've sometimes found
myself wondering if I should declare all my int's as Int32's.I use the keyword names in my code for the sake of keyword higlighting
- but for library methods, you should use the type name (eg
Convert.ToInt32) so that it's not tailored to one particular .NET
language.
--
Jon Skeet - <s...@pobox.com>http://www.pobox.com/~skeet Blog:http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Hi Jon,
I do the same for keyword highlighting, but I'm not clear on why I shouldn't
in library methods. Once compiled to CIL, I don't see how it would matter.
Are you suggesting that I use Convert.ToInt32 instead of casting to (int),
even in cases where I know that an explicit cast exists?
--
Dave Sexton
"Jon Skeet [C# MVP]" <sk***@pobox.comwrote in message
news:MP************************@msnews.microsoft.c om...
<gb****@gmail.comwrote:
>Is there a benefit to using one over the other? I've sometimes found myself wondering if I should declare all my int's as Int32's.
I use the keyword names in my code for the sake of keyword higlighting
- but for library methods, you should use the type name (eg
Convert.ToInt32) so that it's not tailored to one particular .NET
language.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Dave Sexton <dave@jwa[remove.this]online.comwrote:
I do the same for keyword highlighting, but I'm not clear on why I shouldn't
in library methods. Once compiled to CIL, I don't see how it would matter.
Are you suggesting that I use Convert.ToInt32 instead of casting to (int),
even in cases where I know that an explicit cast exists?
No, I'm suggesting that you write methods with names of ToInt32 and
ToSingle rather than ToInt and ToFloat. I wasn't talking about
implementation, just naming - sorry to confuse :(
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Hi Jon,
Ok, that makes more sense!
--
Dave Sexton
"Jon Skeet [C# MVP]" <sk***@pobox.comwrote in message
news:MP************************@msnews.microsoft.c om...
Dave Sexton <dave@jwa[remove.this]online.comwrote:
>I do the same for keyword highlighting, but I'm not clear on why I shouldn't in library methods. Once compiled to CIL, I don't see how it would matter.
Are you suggesting that I use Convert.ToInt32 instead of casting to (int), even in cases where I know that an explicit cast exists?
No, I'm suggesting that you write methods with names of ToInt32 and
ToSingle rather than ToInt and ToFloat. I wasn't talking about
implementation, just naming - sorry to confuse :(
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Is this alias something internal to the compiler, or declared somewhere in
code?
In other words, could I use this aliasing feature for my own types?
Kevin
"Marina Levit [MVP]" <so*****@nospam.comwrote in message
news:eM**************@TK2MSFTNGP03.phx.gbl...
None.
'string' is an alias for the 'String' class. Just as 'int' is an alias for
the Int32 structure, and so on.
"Martin Arvidsson" <ye*******@ms.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>Hi
What is the difference by using String myString or string myString when declaring a string ?
Regards Martin
Kevin Frey <ke**********@hotmail.comwrote:
Is this alias something internal to the compiler, or declared somewhere in
code?
In other words, could I use this aliasing feature for my own types?
You can alias types with the "using" directive at the start of a file,
but you can't add your own "global" aliases.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Agent Mulder |
last post by:
My funky new compiler does not understand
string, but it does understand String, so that this
program gives the expected result:
#include<iostream>
#include<string>
int main()
{
String...
|
by: Ren? M?hle |
last post by:
I have a psp script with a procedure just to run an update on one
table.
The Problem occurs when I try to compile this script with pspload:
ORA-20006: "frsys_updatereport.psp": compilation...
|
by: Hessam |
last post by:
Hello,
I am designing a .net custom control in VS.net 7.1 and my control exposes an
array of strings which are supposed to be the items to show. To do this have
declared a private string variable...
|
by: J. Oliver |
last post by:
I am attempting to copy a portion of a string into another string. Say
I have "abcdef" in string 'a' and want to copy only "bcd" into a new
string 'b'. The following function came to mind:
...
|
by: Ioannis Vranos |
last post by:
When we assign a managed or unmanaged string literal to a String *, is a new String
created implicitly in the managed heap?
Or in other words, what happens when we assign a string literal to...
| |
by: Maileen |
last post by:
Hi,
How can we convert string^ to String or to LPCWSTR ?
thx,
Maileen
|
by: Green |
last post by:
Hi,
I am reading about an article of user control at the following site:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconexposingpageletproperties.asp
and i...
|
by: Terry Olsen |
last post by:
I have an app that makes decisions based on string content. I need to make
sure that a string does not contain only spaces or newlines. I am using the
syntax 'Trim(String)" and it works fine. I...
|
by: pbmanikandan |
last post by:
Horrible error.
I use a function called cleanse company name that "removes" some strings if present from a string that is passed to it.
In a procedure, I do the following.
INSERT into table1...
|
by: ahd2008 |
last post by:
Good day all,
I am creating a new from for the purpose of allowing the Admin(s) to create new users. There is a filed for the password and another one to confirm the password. However, MS Access...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
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: 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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |