10-4 Episode 8: Pure Client-Side Development with ASP.NET AJAX 4.0
For more 10-4 episodes, be sure to visit:
https://channel9.msdn.com/shows/10-4
Visual Basic Team Blog:
https://blogs.msdn.com/vbteam
Generic Variance in Visual Basic:
http://tinyurl.com/VBGenericVariance
Visual Studio Topic Area on Channel 9:
https://channel9.msdn.com/VisualStudio
Visual Studio 2010 CTP VPC:
http://tinyurl.com/GetCTP
10-4! Over and out!
Nice video again.
Unfortunately I don't see the (all) new features as an improvements.
Ok, not having to use the line-continuation character is nice as well as the auto properties, but things like (multiline) lambas just make the code more difficult to read.
The same with 'anonymous types'...
Maybe it is because I haven't seen a good example where the features mentioned above are usefull.
But ofcourse it's up to the programmer to use it or not.
I agree that we need a better window management experience. I absolutely do need the layout to be context sensitive in that when I'm writing code debugging windows like the watch or the call stack are useless and should be kept out of site and when I run my program the design window, toolbox, and solution explorer probably aren't very useful. I think it's good that the VS team understands that different tool windows may need to be different places in context but we need a more explicit way of managing that. I would like to see named layouts and allow me to have more than just two. I work in multiple roles with VS and some roles and tasks need to emphasize a certain layout.
Interface IEntityConverter(Of TSource, TTarget)
Function Convert() As TTarget
Function ConvertBack() As TSource
End Interface
Structure Phone : Implements IEntityConverter(Of String, Phone)
Public ReadOnly Property Extension As String
Public ReadOnly Property AreaCode As String
Public Property Number As String
Public Sub New (phone As String)
Public Function Convert() As Phone Implements IEntityConverter(Of String, Phone).Convert
Return Me
End Function
Public Function ConvertBack() As String Implements IEntityConverter(Of String, Phone).ConvertBack
Return Number
End Function
End Structure
'Usage:
Using data As New Entities
Dim p As Phone = (From c In data.Contacts Select c.Phone).First
notice that phone in the database is a plain string of course
same should be mapping to classes and interfaces
That's all I have for now (I have a lot but don't remember right now), I'd love to hear how fool (or not?) I am...
I also have pain with the 08 version regarding Code snippets and project templates, they are based in the Program Files folder instead of being in the Documents.
so everytime I reinstall my OS I have to play around with the snippets and the templates, it's a real pain (I edited many existing default snippets and templates of VS).
I hope this is the right place to post about it after all not i started to talk about.., any referrals will be appreciated anyway.
Take it easy brother, I just brought plain examples, forget about the specific data.
1) I would never use Dim integer = "45", I just meant that you don't need to explicitly convert anything, and yes, sometimes when you are sure that the String's value is actually an integer you don't have to pass it to another Parse function.
2) Enums in vb can be automatically used as plain integers so u can use it in some cases even to make some calculations and conditions according to the order of it, not only but I make the numbers in my enum according to the desired calculations I expect later,
u can even use bit shift if you have very large enums with key values so u make the key values 8 16 32 and use bit shift etc. again, I just brought you examples to explain what I said but the examples are not the code, so chill about it.
3-4) I don't; Instead I write comments on every line.
And no, don't learn from me, this is just my taste, and if you really want to hear, sometimes I could write
Dim x As Integer
If x Then
Console.WriteLine("x <> 0") 'Will never reach this line since x =
0.
With the above example I mean 2 things, 1st, that integers can be evaluated as booleans, and 2nd, you can rely on the fact that integer is not nullable and bacomes automatically 0 when declaring the field.
Especially, this days that you can oficcially declare Dim x = 5 and the compiler automatically recognize it as integer and even provides full intellisense support.
I would agree with you concerning the readability issue, but I told you I am good with comments, besides I am not working with a group, so I am the one who decides about the coding conventions, and I do have strict conventions.
I would also say "Different strokes for different folks".
Personally, that's why I like VB, FLEXIBILITY!
Thanks for your post, would like further discussions
Best regards,
Shimmy Weitzhandler
I am disappointed by the loosening tendency that started with anonymous types and type inference. It continues to grow turning slowly vb.net into vbscript back again. Been there and hoped never to return but it seems it's all about fashion: you have to periodically change everything whether you need changes or not in order to sell news.