I realize this is the wrong forum for this question, but I'm not sure where to ask, so this will have to do
Having become used to the power and simplicity that generics offer in the regular .NET Framework, is there any chance they will come to NETMF?
Generics in NETMF
Started by Dan Morphis, Feb 11 2011 07:12 PM
3 replies to this topic
#1
Posted 11 February 2011 - 07:12 PM
#2
Posted 11 February 2011 - 07:40 PM
According to the information provided on the official site, "Generics would increase the footprint seriously". I guess it may be added in future, if the demand is strong enough, at least on platforms that would have sufficient resources.Having become used to the power and simplicity that generics offer in the regular .NET Framework, is there any chance they will come to NETMF?
#3
Posted 12 February 2011 - 05:40 AM
I don't have any special insight into what Microsoft is doing or what Bill Gates wants to spend his money on, but I think it's extremely unlikely.Having become used to the power and simplicity that generics offer in the regular .NET Framework, is there any chance they will come to NETMF?
The reason is that (unlike templates in C++, where all the work is done by the compiler at compile time), generics in C# require a lot of support from the runtime. This means that the Micro Framework would have to be completely rewritten (and it would also need more RAM). I'm not saying it's impossible, but it would be a huge undertaking.
To give you an idea of just one of the many issues involved, below is a simple program which uses a type that the compiler has no chance of knowing, differs for every run of the program, and is not even determinable until runtime:
using System; using System.Collections.Generic; using System.Diagnostics; namespace ConsoleApplication9 { public class Program { public static void Main() { Debug.Print(Func1<double>(new Random().Next(500))); } private static string Func1<T>(int depth) where T : new() { if(depth==0) { return Func2(new T()); } else { return Func1<List<T>>(depth-1); } } private static string Func2<T>(T arg) { return arg.GetType().FullName; } } }
Note: this is full-framework code, not Micro Framework code. And, by the way, the above program is literally impossible to write in C++
- Giuliano likes this
#4
Posted 12 February 2011 - 08:21 AM
It might be safe to state that, it's rather unlikely ever to implemented on small devices like the Netduino. Sadly.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users