473,769 Members | 7,058 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 1671
"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
1669
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
1315
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
1791
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
8180
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
9589
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
9423
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
8873
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
7413
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
6675
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
5309
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...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
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.