Hello
I was just got VS 2005 preview, and was trying generics.
I tried the following code
int[] intArray = new int[100];
IList<int> intList = (IList<int>) intArray;
it didn't compile, also the following didn't compile
IEnumerable<int> intEnumerable = (IEnumerable<int>)intArray;
IMHO it makes perfect sense that int[] should implement IList<int>,
IEnumerable<int>, etc, since it implements the non-generic IList, and
IEnumerable.
Best regards,
Sherif 13 2571
Please, post whidbey questions to the private whidbey NG, This NG is for
released products.
Willy.
"Sherif ElMetainy" <el*************@wayout.net.NOSPAM> wrote in message
news:e9**************@TK2MSFTNGP11.phx.gbl... Hello
I was just got VS 2005 preview, and was trying generics.
I tried the following code
int[] intArray = new int[100]; IList<int> intList = (IList<int>) intArray;
it didn't compile, also the following didn't compile
IEnumerable<int> intEnumerable = (IEnumerable<int>)intArray;
IMHO it makes perfect sense that int[] should implement IList<int>, IEnumerable<int>, etc, since it implements the non-generic IList, and IEnumerable.
Best regards, Sherif
Please, post whidbey questions to the private whidbey NG, This NG is for
released products.
Willy.
"Sherif ElMetainy" <el*************@wayout.net.NOSPAM> wrote in message
news:e9**************@TK2MSFTNGP11.phx.gbl... Hello
I was just got VS 2005 preview, and was trying generics.
I tried the following code
int[] intArray = new int[100]; IList<int> intList = (IList<int>) intArray;
it didn't compile, also the following didn't compile
IEnumerable<int> intEnumerable = (IEnumerable<int>)intArray;
IMHO it makes perfect sense that int[] should implement IList<int>, IEnumerable<int>, etc, since it implements the non-generic IList, and IEnumerable.
Best regards, Sherif
Sherif,
Given that System.Array implements IList and IEnumerable, the
specialized versions should definitely be supported.
I'll file a bug. Thanks for finding it.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Sherif ElMetainy" <el*************@wayout.net.NOSPAM> wrote in message
news:e9**************@TK2MSFTNGP11.phx.gbl... Hello
I was just got VS 2005 preview, and was trying generics.
I tried the following code
int[] intArray = new int[100]; IList<int> intList = (IList<int>) intArray;
it didn't compile, also the following didn't compile
IEnumerable<int> intEnumerable = (IEnumerable<int>)intArray;
IMHO it makes perfect sense that int[] should implement IList<int>, IEnumerable<int>, etc, since it implements the non-generic IList, and IEnumerable.
Best regards, Sherif
Sherif,
Given that System.Array implements IList and IEnumerable, the
specialized versions should definitely be supported.
I'll file a bug. Thanks for finding it.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Sherif ElMetainy" <el*************@wayout.net.NOSPAM> wrote in message
news:e9**************@TK2MSFTNGP11.phx.gbl... Hello
I was just got VS 2005 preview, and was trying generics.
I tried the following code
int[] intArray = new int[100]; IList<int> intList = (IList<int>) intArray;
it didn't compile, also the following didn't compile
IEnumerable<int> intEnumerable = (IEnumerable<int>)intArray;
IMHO it makes perfect sense that int[] should implement IList<int>, IEnumerable<int>, etc, since it implements the non-generic IList, and IEnumerable.
Best regards, Sherif
Nicholas Paldino [.NET/C# MVP] wrote: Sherif,
Given that System.Array implements IList and IEnumerable, the specialized versions should definitely be supported.
I'll file a bug. Thanks for finding it.
I don't think this is going to be possible without creating
System.Int32Array, System.StringArray, etc.
Example:
int[] array1 = new int[100];
string[] array2 = new string[50];
Both of these objects (array1 and array2) are of type System.Array. How
can one of them implement IList<int> and the other implement
IList<string>? How could the compiler have any way of knowing which
interfaces are implemented by which instances?
There just isn't a way for two instances of the same type to implement
different interfaces; it breaks way too many OOP rules.
Kevin,
You misunderstood the implication that I was making. Basically, because
System.Array (the general base for all arrays) implements IList, and
IEnumerable, the specialized arrays (int[], string[], etc, etc) should also
implement the specialized versions (IList<int> and IEnumerable<int>) as
well.
Also, array1 and array2 are not of type System.Array. Rather, they
derive from System.Array. Because of this, it is easy for the derivation to
implement IList<T>.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Kevin P. Fleming" <kp*******@backtobasicsmgmt.com> wrote in message
news:ud*************@TK2MSFTNGP09.phx.gbl... Nicholas Paldino [.NET/C# MVP] wrote:
Sherif,
Given that System.Array implements IList and IEnumerable, the specialized versions should definitely be supported.
I'll file a bug. Thanks for finding it.
I don't think this is going to be possible without creating System.Int32Array, System.StringArray, etc.
Example:
int[] array1 = new int[100]; string[] array2 = new string[50];
Both of these objects (array1 and array2) are of type System.Array. How can one of them implement IList<int> and the other implement IList<string>? How could the compiler have any way of knowing which interfaces are implemented by which instances?
There just isn't a way for two instances of the same type to implement different interfaces; it breaks way too many OOP rules.
Nicholas Paldino [.NET/C# MVP] wrote: You misunderstood the implication that I was making. Basically, because System.Array (the general base for all arrays) implements IList, and IEnumerable, the specialized arrays (int[], string[], etc, etc) should also implement the specialized versions (IList<int> and IEnumerable<int>) as well.
Also, array1 and array2 are not of type System.Array. Rather, they derive from System.Array. Because of this, it is easy for the derivation to implement IList<T>.
OK, I did not realize that array1 and array2 would be instances of a
type derived from System.Array. Is this true whenever I declare any
array? I was not aware that the C# compiler created hidden types to be
used to implement arrays. I guess it must, otherwise array1[0] would be
a System.Object, not a System.Int32.
Given this information, implementing the IList and IEnumerator generics
would be relatively easy and quite useful.
Kevin,
This is true when you delcare any array. Your array type is T[]. The
base of T[] is System.Array.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Kevin P. Fleming" <kp*******@backtobasicsmgmt.com> wrote in message
news:uU*************@tk2msftngp13.phx.gbl... Nicholas Paldino [.NET/C# MVP] wrote:
You misunderstood the implication that I was making. Basically,
because System.Array (the general base for all arrays) implements IList, and IEnumerable, the specialized arrays (int[], string[], etc, etc) should
also implement the specialized versions (IList<int> and IEnumerable<int>) as well.
Also, array1 and array2 are not of type System.Array. Rather, they derive from System.Array. Because of this, it is easy for the
derivation to implement IList<T>.
OK, I did not realize that array1 and array2 would be instances of a type derived from System.Array. Is this true whenever I declare any array? I was not aware that the C# compiler created hidden types to be used to implement arrays. I guess it must, otherwise array1[0] would be a System.Object, not a System.Int32.
Given this information, implementing the IList and IEnumerator generics would be relatively easy and quite useful.
Hello
"Kevin P. Fleming" <kp*******@backtobasicsmgmt.com> wrote in message
news:ud*************@TK2MSFTNGP09.phx.gbl... Nicholas Paldino [.NET/C# MVP] wrote:
There just isn't a way for two instances of the same type to implement different interfaces; it breaks way too many OOP rules.
Although int[] and string[] inherit from System.Array, they are not the same
type. System.Array implements the non generic IList, so int[] should
implement IList<int> and string[] should implement IList<string>
Best regards,
Sherif
Hello
Sorry for any inconvenience, but I think people using released version of c#
are intrested in future versions as well.
Best regards,
Sherif
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:#P*************@TK2MSFTNGP09.phx.gbl... Please, post whidbey questions to the private whidbey NG, This NG is for released products.
Willy.
"Sherif ElMetainy" <el*************@wayout.net.NOSPAM> wrote in message news:e9**************@TK2MSFTNGP11.phx.gbl... Hello
I was just got VS 2005 preview, and was trying generics.
I tried the following code
int[] intArray = new int[100]; IList<int> intList = (IList<int>) intArray;
it didn't compile, also the following didn't compile
IEnumerable<int> intEnumerable = (IEnumerable<int>)intArray;
IMHO it makes perfect sense that int[] should implement IList<int>, IEnumerable<int>, etc, since it implements the non-generic IList, and IEnumerable.
Best regards, Sherif
Thanks
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:eC**************@TK2MSFTNGP09.phx.gbl... Sherif,
Given that System.Array implements IList and IEnumerable, the specialized versions should definitely be supported.
I'll file a bug. Thanks for finding it.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com "Sherif ElMetainy" <el*************@wayout.net.NOSPAM> wrote in message news:e9**************@TK2MSFTNGP11.phx.gbl... Hello
I was just got VS 2005 preview, and was trying generics.
I tried the following code
int[] intArray = new int[100]; IList<int> intList = (IList<int>) intArray;
it didn't compile, also the following didn't compile
IEnumerable<int> intEnumerable = (IEnumerable<int>)intArray;
IMHO it makes perfect sense that int[] should implement IList<int>, IEnumerable<int>, etc, since it implements the non-generic IList, and IEnumerable.
Best regards, Sherif
Hi,
Sorry, but I have to disagree,those really interested in future versions can
also subscribe to the private Whidbey NG's., and those actually having
issues with this new stuff, will find better answers in the Whidbey NG's
(MSFT PM are actively monitoring these NG's). And don't forget that we are
talking about pre-alpha code here, nothing is carved in stone yet, some
might really get confused when reading messages about un-released stuff in
public NG's.
Willy.
"Sherif ElMetainy" <el*************@wayout.net.NOSPAM> wrote in message
news:et**************@TK2MSFTNGP11.phx.gbl... Hello
Sorry for any inconvenience, but I think people using released version of c# are intrested in future versions as well.
Best regards, Sherif
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message news:#P*************@TK2MSFTNGP09.phx.gbl... Please, post whidbey questions to the private whidbey NG, This NG is for released products.
Willy.
"Sherif ElMetainy" <el*************@wayout.net.NOSPAM> wrote in message news:e9**************@TK2MSFTNGP11.phx.gbl... > Hello > > I was just got VS 2005 preview, and was trying generics. > > I tried the following code > > int[] intArray = new int[100]; > IList<int> intList = (IList<int>) intArray; > > it didn't compile, also the following didn't compile > > IEnumerable<int> intEnumerable = (IEnumerable<int>)intArray; > > IMHO it makes perfect sense that int[] should implement IList<int>, > IEnumerable<int>, etc, since it implements the non-generic IList, and > IEnumerable. > > Best regards, > Sherif > >
Hello
I am corrected. Sorry for the inconvenience.
Best regards,
Sherif
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:OV*************@TK2MSFTNGP10.phx.gbl... Hi, Sorry, but I have to disagree,those really interested in future versions
can also subscribe to the private Whidbey NG's., and those actually having issues with this new stuff, will find better answers in the Whidbey NG's (MSFT PM are actively monitoring these NG's). And don't forget that we are talking about pre-alpha code here, nothing is carved in stone yet, some might really get confused when reading messages about un-released stuff in public NG's.
Willy.
"Sherif ElMetainy" <el*************@wayout.net.NOSPAM> wrote in message news:et**************@TK2MSFTNGP11.phx.gbl... Hello
Sorry for any inconvenience, but I think people using released version
of c# are intrested in future versions as well.
Best regards, Sherif
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message news:#P*************@TK2MSFTNGP09.phx.gbl... Please, post whidbey questions to the private whidbey NG, This NG is
for released products.
Willy.
"Sherif ElMetainy" <el*************@wayout.net.NOSPAM> wrote in message news:e9**************@TK2MSFTNGP11.phx.gbl... > Hello > > I was just got VS 2005 preview, and was trying generics. > > I tried the following code > > int[] intArray = new int[100]; > IList<int> intList = (IList<int>) intArray; > > it didn't compile, also the following didn't compile > > IEnumerable<int> intEnumerable = (IEnumerable<int>)intArray; > > IMHO it makes perfect sense that int[] should implement IList<int>, > IEnumerable<int>, etc, since it implements the non-generic IList, and > IEnumerable. > > Best regards, > Sherif > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Anonymous |
last post by:
Is there a non-brute force method of doing this?
transform() looked likely but had no predefined function object.
std::vector<double> src;
std::vector<int> dest;
...
|
by: pmatos |
last post by:
Hi all,
I have a vector of vector of ints, I could use C approach by using
int but I think C++ vector<vector<int> > would be easier to manage.
So I have a function which creates and initializes...
|
by: Piotr |
last post by:
I have a class 'Statistics' which has a private attribute
' vector<int>* _x;'
And in the destructor of the Statistics, I have this code to free the
memory:
Statistics::~Statistics()
{
if...
|
by: per9000 |
last post by:
Hi,
*background*
I want a class containing an int (a list of sets of integer). This
should be hidden for the user and he/she should be able to insert
his/her favourite data structure so to be a...
|
by: arnuld |
last post by:
It is quite an ugly hack but it is all I am able to come up with for
now :-( and it does the requires work. I want to improve the program, I
know you people have much better ideas ;-)
/* C++...
|
by: arnuld |
last post by:
WANTED:
/* C++ Primer - 4/e
*
* Exercise: 9.26
* STATEMENT
* Using the following definition of ia, copy ia into a vector and
into a list. Use the single iterator form of erase to...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: kcodez |
last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: Taofi |
last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same
This are my field names
ID, Budgeted, Actual, Status and Differences
...
|
by: DJRhino1175 |
last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this -
If...
|
by: Rina0 |
last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
|
by: DJRhino |
last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer)
If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _
310030356 Or 310030359 Or 310030362 Or...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
| |