Click here to Skip to main content
15,898,373 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: WebUIValidation.js and .NET 2.0 upgrade. Pin
imnotso#4-Feb-09 1:20
imnotso#4-Feb-09 1:20 
GeneralRe: WebUIValidation.js and .NET 2.0 upgrade. Pin
Colin Angus Mackay5-Feb-09 12:35
Colin Angus Mackay5-Feb-09 12:35 
GeneralRe: WebUIValidation.js and .NET 2.0 upgrade. Pin
imnotso#5-Feb-09 22:57
imnotso#5-Feb-09 22:57 
GeneralRe: WebUIValidation.js and .NET 2.0 upgrade. Pin
Colin Angus Mackay5-Feb-09 23:23
Colin Angus Mackay5-Feb-09 23:23 
GeneralRe: WebUIValidation.js and .NET 2.0 upgrade. Pin
imnotso#5-Feb-09 23:35
imnotso#5-Feb-09 23:35 
QuestionThe specified module could not be found. (Exception from HRESULT: 0x8007007E [modified] Pin
tsanthosh3-Feb-09 22:42
tsanthosh3-Feb-09 22:42 
QuestionHi guys - is it possible to cast generic up the specific types hierarchy??? Pin
netguruMelb3-Feb-09 20:59
netguruMelb3-Feb-09 20:59 
AnswerRe: Hi guys - is it possible to cast generic up the specific types hierarchy??? Pin
Gideon Engelberth4-Feb-09 3:33
Gideon Engelberth4-Feb-09 3:33 
This has to do with the concepts of covariance and contra variance. There are some nice articles explaining how this is being planned for interfaces in the next version of the framework, but right now you can't do that sort of thing.

To see what could happen if you were allowed to do the kind of cast you wanted, I'll show you a simpler example that has the same problem.

Dim myList As New List(Of String)

Private Sub AddToList(ByVal collection As List(Of Object))
    collection.Add(New Object())
End Sub

'what should happen when you call this line?
AddToList(CType(myList, List(Of Object))

'or if the previous line works, what about here
Dim lastLength As Integer = myList(myList.Count - 1).Length


The restriction is that the compiler must be able to perform compile-time verification that the only things going into and coming out of a generic class are the generic type specified when the instance was created (as opposed to Arrays, which do run-time verification and throw exceptions instead). This means you cannot convert a List(Of String) into a List(Of Object) because there is no good way for the compiler to know what you will do with the list once you convert it.
AnswerRe: Hi guys - is it possible to cast generic up the specific types hierarchy??? Pin
supercat94-Feb-09 5:17
supercat94-Feb-09 5:17 
QuestionFinding a given day or weekday x months from today Pin
nzmike3-Feb-09 14:34
nzmike3-Feb-09 14:34 
GeneralRe: Finding a given day or weekday x months from today Pin
Luc Pattyn3-Feb-09 16:13
sitebuilderLuc Pattyn3-Feb-09 16:13 
AnswerRe: Finding a given day or weekday x months from today Pin
Jon Rista3-Feb-09 16:19
Jon Rista3-Feb-09 16:19 
AnswerRe: Finding a given day or weekday x months from today Pin
nzmike3-Feb-09 16:25
nzmike3-Feb-09 16:25 
GeneralRe: Finding a given day or weekday x months from today Pin
Luc Pattyn3-Feb-09 17:30
sitebuilderLuc Pattyn3-Feb-09 17:30 
GeneralRe: Finding a given day or weekday x months from today Pin
Jon Rista4-Feb-09 6:25
Jon Rista4-Feb-09 6:25 
AnswerRe: Finding a given day or weekday x months from today Pin
cmk3-Feb-09 20:45
cmk3-Feb-09 20:45 
QuestionSmart Card Pin
Mohd Atiq3-Feb-09 1:38
Mohd Atiq3-Feb-09 1:38 
AnswerRe: Smart Card Pin
annathor5-Feb-09 1:52
annathor5-Feb-09 1:52 
Questionbook Pin
welcan3-Feb-09 1:02
welcan3-Feb-09 1:02 
AnswerRe: book Pin
EliottA3-Feb-09 7:10
EliottA3-Feb-09 7:10 
AnswerRe: book Pin
vaghelabhavesh3-Feb-09 8:38
vaghelabhavesh3-Feb-09 8:38 
QuestionOracle Transactions Handling in ASP .NET Pin
summon_192-Feb-09 23:04
summon_192-Feb-09 23:04 
AnswerRe: Oracle Transactions Handling in ASP .NET Pin
Wendelius3-Feb-09 7:54
mentorWendelius3-Feb-09 7:54 
QuestionSerialization of List<> and Remoting [modified] Pin
Andez20042-Feb-09 22:00
Andez20042-Feb-09 22:00 
QuestionCAS policy how to assign to a specific app Pin
Dan Neely2-Feb-09 8:00
Dan Neely2-Feb-09 8:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.