473,320 Members | 1,810 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,320 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 1646
"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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.