473,756 Members | 8,006 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.GCollect ions.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 1669
"Matthew W. Jackson" <th*****@hotmai l.com> schrieb im Newsbeitrag
news:iJ******** *************@n ewssvr11.news.p rodigy.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.GCollect ions.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*****@hotmai l.com> schrieb im Newsbeitrag
news:iJ******** *************@n ewssvr11.news.p rodigy.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.GCollect ions.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.WriteLi ne(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*****@hotmai l.com> wrote in message
news:iJ******** *************@n ewssvr11.news.p rodigy.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.GCollect ions.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.WriteLi ne(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*****@hotmai l.com> wrote in message
news:iJ******** *************@n ewssvr11.news.p rodigy.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.GCollect ions.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*****@hotmai l.com> wrote in message
news:iJ******** *************@n ewssvr11.news.p rodigy.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.GCollect ions.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
296
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 Int32ArrayList = System.GCollections.ArrayList<Int32>; .... Int32ArrayList myArrayList = new Int32ArrayList();
18
1668
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 pasting it here as well... enjoy! (you can skip to the source at the end of the message if you like...) Consider:
9
1312
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 view of the world. Migrating some aspects of my antiquated style has been straight-forward. For example: I used to do this:
12
2744
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 it defines the language more completely. Great to use.
1
1893
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 = new List<IPerson>(); ... // get the persons return personList;
10
1789
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 declaration is ambiguous (between the 2 BeginGroup methods). But what if I want to refer them both?
9
1688
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: BaseEdit class FooEdit: BaseEdit These are all acutally Windows Forms and BaseEdit is an abstract class (and so never gets instantiated). I'd like to define a method in
190
8159
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 C++ at a local polytechnical school here in Vancouver, Canada for approximately 8 years. Six years ago, at the height (or should I say volume?) of the internet bubble, I had 80+ students per semester in my C++ course. Now I am fortunate to have...
5
1720
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 whole code uses the "old" managed C++ syntax. Due to the amount of code and the need of supporting .NET 1.1 it is not possible for us to port the complete code to the new CLI/C++ syntax. We would like to use the new Generics. We have written a...
0
9904
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
9884
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8736
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7285
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
6556
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
5168
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3828
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
3395
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2697
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.