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 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
"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
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
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
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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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...
|
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 =...
|
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...
|
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:...
|
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...
|
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...
|
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...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
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...
|
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...
|
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)...
|
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...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
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
|
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...
| |