473,657 Members | 2,405 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C++ typedef equivalent in C#

Is there a C++ typedef equivalent in C#?

Thanks,
--
George
Jun 13 '06 #1
4 7445
George <wa**@nospam.no spam> wrote:
Is there a C++ typedef equivalent in C#?


Not a "global" one, but you can use a using directive for a single
file:

using FooBar = System.String;

....

FooBar x = "Hello";

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jun 13 '06 #2
Thanks.

Unfortunately, I am hoping for a "global typedef" equivalent....
--
George
"Jon Skeet [C# MVP]" wrote:
George <wa**@nospam.no spam> wrote:
Is there a C++ typedef equivalent in C#?


Not a "global" one, but you can use a using directive for a single
file:

using FooBar = System.String;

....

FooBar x = "Hello";

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

Jun 13 '06 #3
No problem -- just put it in an include file.

D'oh! :) Sometimes I miss C++. Not often, but sometimes.

///ark

"George" <wa**@nospam.no spam> wrote in message
news:48******** *************** ***********@mic rosoft.com...
Thanks.

Unfortunately, I am hoping for a "global typedef" equivalent....
--
George
"Jon Skeet [C# MVP]" wrote:
George <wa**@nospam.no spam> wrote:
> Is there a C++ typedef equivalent in C#?


Not a "global" one, but you can use a using directive for a single
file:

using FooBar = System.String;

....

FooBar x = "Hello";

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

Jun 13 '06 #4
Hi,

AFAIK this is not possible.
If you are going to create new files with this request you could define a
template and select it when selecting "Add new Item" from the project
explorer.

--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"George" <wa**@nospam.no spam> wrote in message
news:48******** *************** ***********@mic rosoft.com...
Thanks.

Unfortunately, I am hoping for a "global typedef" equivalent....
--
George
"Jon Skeet [C# MVP]" wrote:
George <wa**@nospam.no spam> wrote:
> Is there a C++ typedef equivalent in C#?


Not a "global" one, but you can use a using directive for a single
file:

using FooBar = System.String;

....

FooBar x = "Hello";

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

Jun 13 '06 #5

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

Similar topics

2
3627
by: joe | last post by:
hi, after reading some articles and faq, i want to clarify myself what's correct(conform to standard) and what's not? or what should be correct but it isn't simply because compilers don't support. (first i compiled them with g++3.x. ERR means compiler will bark, otherwise it does accept it. Then the Comeau C/C++ 4.3.3 comes)
2
2928
by: Mehta Shailendrakumar | last post by:
Hi all, Have alook at two different declarations below: typedef unsigned char uc; typedef void (*fptr) (void); The first declaration has a left part which is a C keyword: "unsigned char" and the declaration is clarly understandable.
7
2454
by: Dennis Myrén | last post by:
Hi. Is there any way to define an alias for a type like you could in C++: typedef int NUMBER; I tried using #define but that did not work. Thank you. -- Regards,
12
15632
by: vvv | last post by:
Hi All, Do we have anything in .NET which is equivalent to C++'s Typedef . Regards, Vasanth
134
9021
by: jacob navia | last post by:
Hi Suppose you have somewhere #define BOOL int and somewhere else typedef BOOL int;
10
3913
by: Christian Christmann | last post by:
Hi, what is the difference between a "#define" and typedef? A "#define" is handled by the preprocessor and serves as a name substitude whereas "typedef" is a declaration of a new data type based on an exisiting one and handled by a compiler. So, actually both things are equivalent? Or are there any special cases where it makes a difference which specifier is used?
5
509
by: John | last post by:
I thought I had a fairly good understanding of typedefs until I came across the following passage from C++ Primer, fourth edition by Stanley B. Lippman: "The mistake is in thinking of a typedef as a textual expansion" (page 129). All of my other C++ books and every mention of typedefs that I've seen on the Internet simply call typedefs a new name as an alias for a type, e.g. typedef char byte ; // make byte an alias for char (from C++...
4
415
by: rajm2019 | last post by:
hi to all i am new to c++ i want to know wat do we mean bye typedef support::PtrObject<DirectoryDirectoryRef when we are using (DirectoryRef abc); is abc an object of template class support::PtrObject<Directoryor something else.
8
3739
by: Carmen Sei | last post by:
I found in C++ a type is typedef several times and alot of time, I need to dig further to see the original type. like LPDWORD - it's a strange type, but when i dig further, i see it's a (DWORD *) =========== typedef DWORD near *PDWORD; typedef DWORD far *LPDWORD;
0
8420
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8324
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8842
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8740
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6176
isladogs
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5642
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
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 we have to send another system
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.