Quote:
|
As I understand it they are class objects without any real data type attached to them. Kind of like the variable declartions in JavaScript no data types attached to them. Is that not the case. I think that with generics it makes it easier to type cast variables to objects easier as it allows for more of an easier allocation of stack and heap conversions when doing typecasts from variables to objects? Is that right?
|
Nope. It's pretty much the exact opposite. With generics you can create strongly typed classes. However when you define the generic type, you leave the actual type to the user of your type. Generics are best seen as templates. Imagine the following List<T> class from the .,NET Framework:
Code:
public class List<T> : ....
{
public void Add (T item)
{
}
}
When you declare a type with this class like this:
List<int> MyList = new List<int>();
the compiler uses the orginal list as a template and creates a class such as this one:
Code:
public class ListInt : ....
{
public void Add (int item)
{
}
}
The same could happen for a string type:
Code:
public class ListString : ....
{
public void Add (string item)
{
}
}
This is not exactly how it's done, but it comes close to the underlying concept.
Check out Pro Generics by Tod Golling:
http://www.wrox.com/WileyCDA/WroxTit...764559885.html for way more details.
Quote:
|
Does not LINQ and the EF put a lot of overhead that causes the scalability issues for large user groups problems?
|
No, not if done right. StackOverflow.com is one of the busiest sites on the internet and it uses LINQ to SQL.
Can you please post a new thread for a new topic? Also, the last question (and possible the first) are much better off in generic forums about ASP.NET or .NET as they are not directly related to my book. Just pick an appropriate forum category here:
http://p2p.wrox.com/asp-net-asp-12/
http://p2p.wrox.com/
Imar