473,405 Members | 2,282 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,405 software developers and data experts.

Question About Future C# Syntax (Generics)

I had a question about the "using" statement and Generics in the next
version of C#, and I was directed to this newsgroup. My question is: Will
the following syntax be valid?
using Int32ArrayList = System.GCollections.ArrayList<Int32>;
....
Int32ArrayList myArrayList = new Int32ArrayList();
I (along with many others) use a similar method in C++ with typedefs, and to
me it really makes STL code a lot cleaner. I see no reason why this should
not be possible in Whidbey C#, but I may be missing something. This is of
course a trivial example, but in cases where there are several template
parameters (and even moreso, nesting), it really helps.

I don't have time to install Rotor and Gyro to find out if it works in that
environment, so I thought I'd ask here first.

Thanks in advance,

Matthew W. Jackson
Nov 15 '05 #1
5 1649
"Matthew W. Jackson" <th*****@hotmail.com> schrieb im Newsbeitrag
news:iJ*********************@newssvr11.news.prodig y.com...
I had a question about the "using" statement and Generics in the next
version of C#, and I was directed to this newsgroup. My question is: Will
the following syntax be valid?

using Int32ArrayList = System.GCollections.ArrayList<Int32>;
...
Int32ArrayList myArrayList = new Int32ArrayList();


I heard that they are considering some using alias directives support for
generics for Whidbey.

Jürgen Beck
MCSD.NET, MCDBA, MCT
www.Juergen-Beck.de
Nov 15 '05 #2
"Matthew W. Jackson" <th*****@hotmail.com> schrieb im Newsbeitrag
news:iJ*********************@newssvr11.news.prodig y.com...
I had a question about the "using" statement and Generics in the next
version of C#, and I was directed to this newsgroup. My question is: Will
the following syntax be valid?

using Int32ArrayList = System.GCollections.ArrayList<Int32>;
...
Int32ArrayList myArrayList = new Int32ArrayList();


I heard that they are considering some using alias directives support for
generics for Whidbey.

Jürgen Beck
MCSD.NET, MCDBA, MCT
www.Juergen-Beck.de
Nov 15 '05 #3
I'm kinda hoping for some type of inline ILASM block. It would probably be
easiest just to allow one to write the whole function in il, or none of it.
This is kinda what I was thinking:

class Test
{
void Main() {
Console.WriteLine(Add(5, 6));
}

// ilasm function
int ilasm Add(int a, int b) {
ldarg.0 // push a on stack
ldarg.1 // push b on stack
add // add 2 args
ret // return int on the stack
}

/*
C# code for the ilasm is here:
int Add(int a, int b) {
return a + b;
}
*/

}


Chris

"Matthew W. Jackson" <th*****@hotmail.com> wrote in message
news:iJ*********************@newssvr11.news.prodig y.com...
I had a question about the "using" statement and Generics in the next
version of C#, and I was directed to this newsgroup. My question is: Will
the following syntax be valid?
using Int32ArrayList = System.GCollections.ArrayList<Int32>;
...
Int32ArrayList myArrayList = new Int32ArrayList();
I (along with many others) use a similar method in C++ with typedefs, and to me it really makes STL code a lot cleaner. I see no reason why this should not be possible in Whidbey C#, but I may be missing something. This is of
course a trivial example, but in cases where there are several template
parameters (and even moreso, nesting), it really helps.

I don't have time to install Rotor and Gyro to find out if it works in that environment, so I thought I'd ask here first.

Thanks in advance,

Matthew W. Jackson

Nov 15 '05 #4
I'm kinda hoping for some type of inline ILASM block. It would probably be
easiest just to allow one to write the whole function in il, or none of it.
This is kinda what I was thinking:

class Test
{
void Main() {
Console.WriteLine(Add(5, 6));
}

// ilasm function
int ilasm Add(int a, int b) {
ldarg.0 // push a on stack
ldarg.1 // push b on stack
add // add 2 args
ret // return int on the stack
}

/*
C# code for the ilasm is here:
int Add(int a, int b) {
return a + b;
}
*/

}


Chris

"Matthew W. Jackson" <th*****@hotmail.com> wrote in message
news:iJ*********************@newssvr11.news.prodig y.com...
I had a question about the "using" statement and Generics in the next
version of C#, and I was directed to this newsgroup. My question is: Will
the following syntax be valid?
using Int32ArrayList = System.GCollections.ArrayList<Int32>;
...
Int32ArrayList myArrayList = new Int32ArrayList();
I (along with many others) use a similar method in C++ with typedefs, and to me it really makes STL code a lot cleaner. I see no reason why this should not be possible in Whidbey C#, but I may be missing something. This is of
course a trivial example, but in cases where there are several template
parameters (and even moreso, nesting), it really helps.

I don't have time to install Rotor and Gyro to find out if it works in that environment, so I thought I'd ask here first.

Thanks in advance,

Matthew W. Jackson

Nov 15 '05 #5
The answer is "yes", you will be able to do that, but note that you do not
get real typedefs out of this. Typedefs define specific types, while aliases
are just shortcuts.
"Matthew W. Jackson" <th*****@hotmail.com> wrote in message
news:iJ*********************@newssvr11.news.prodig y.com...
I had a question about the "using" statement and Generics in the next
version of C#, and I was directed to this newsgroup. My question is: Will
the following syntax be valid?
using Int32ArrayList = System.GCollections.ArrayList<Int32>;
...
Int32ArrayList myArrayList = new Int32ArrayList();
I (along with many others) use a similar method in C++ with typedefs, and to me it really makes STL code a lot cleaner. I see no reason why this should not be possible in Whidbey C#, but I may be missing something. This is of
course a trivial example, but in cases where there are several template
parameters (and even moreso, nesting), it really helps.

I don't have time to install Rotor and Gyro to find out if it works in that environment, so I thought I'd ask here first.

Thanks in advance,

Matthew W. Jackson

Nov 15 '05 #6

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

Similar topics

0
by: Matthew W. Jackson | last post by:
I had a question about the "using" statement and Generics in the next version of C#, and I was directed to this newsgroup. My question is: Will the following syntax be valid? using...
18
by: Kamen Yotov | last post by:
hi all, i first posted this on http://msdn.microsoft.com/vcsharp/team/language/ask/default.aspx (ask a c# language designer) a couple of days ago, but no response so far... therefore, i am...
9
by: See_Rock_City | last post by:
Hello All, I've decided that this OOP thing is not just a fad. With that in mind, I'm desparately trying to get rid of my function-oriented design paradigm and switch to a more object-centric...
12
by: Michael S | last post by:
Why do people spend so much time writing complex generic types? for fun? to learn? for use? I think of generics like I do about operator overloading. Great to have as a language-feature, as...
1
by: Peter Kirk | last post by:
Hi I have never used generics before, and I was wondering if the following sort of use was acceptable/normal for a method: public IList<IPerson> GetPersons() { IList<IPerson> personList =...
10
by: Lloyd Dupont | last post by:
Let say I have 2 methods: void BeginGroup(); void BeginGroup(string msg); when I want to refer to them I write /// <see cref="BeginGroup"/> But this cause a compiler warning, where my...
9
by: James Crosswell | last post by:
I'm not sure if I'm going about this the right way - it may be that Generics might be able to help me out here... but here goes: I have three classes as follows class BaseEdit class WidgetEdit:...
190
by: blangela | last post by:
If you had asked me 5 years ago about the future of C++, I would have told you that its future was assured for many years to come. Recently, I have been starting to wonder. I have been teaching...
5
by: Budde, Marco | last post by:
We have developed a big library using managed C++. The project started with .NET 1.0 and has been ported to .NET 1.1. Today we ship the library compiled for .NET 1.1 and 2.0. At the moment the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
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...
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
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...

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.