Title: VB'NET Tips and Tricks
1VB.NET Tips and Tricks
Chris Bennett
Crowe Horwath LLP
2- Topics
- Visual Basic.Net Tips Tricks
- Visual Studio Tips Tricks
- Tools
3VB.NET - Tips and Tricks
4 Dim dc As DB_LINQDataContext Try dc New
DB_LINQDataContext() ... Finally
dc.Dispose() End Try
Using dc As New DB_LINQDataContext
... End Using
5- Why Using Statements?
- Simplifies Code
- Automatic Disposing of Classes
6 Using dc As New DB_LINQDataContext
Dim query From c In dc.Customers _
Select c End Using
7- Why LINQ
- Unified access to SQL Tables, Collections, JSON,
etc - Allows SQL -gt Collection Joins
- Extremely Flexible
8- LINQ breeds bad habits
- Essentially Inline SQL
- Build a DAL layer
- We forget performance since LINQ can just about
do it all - LINQ performs its own optimizations on queries
- Almost?
9- LINQ Short Cut Performance Issues
- Returns All Rows
- Searches for match (In Memory)
- Returns Matches
Using dc As New DB_LINQDataContext dc.Customers
.ToList().Find( ... ) End Using
10- LINQ Performance Short Cut
- Perform SQL Select using Where Clause
- Returns only those rows from the database
Using dc As New DB_LINQDataContext dc.Customers
.Where( ) End Using
11- Implicit Typing
- Dont use it !
- (Unavoidable using LINQ)
Dim a 5 Dim s This is a String
12Dim myThread As New Thread(AddressOf
MyThreadMethod) With .Name "my thread",
.IsBackground True
13Visual Studio - Tips and Tricks
14- Ghost Doc
- Rules based engine for documenting function
- Rules are based upon the name of the function
- (VB.Net Support is Experimental)
15Ghost Doc Demo
16- Snippets
- Very handy way to add often used code
- Difficult to build, XML formatted file
- New Snippet Designer
17Snippet Designer Demo
18Web Tools
19- Source Code Converter
- http//www.developerfusion.com/tools/convert/vb-to
-csharp/ - IE Developer Toolbar (Internet Explorer)
- Firebug (Firefox)
- YSlow
20Web Tool Demo
21- Additional Information
- Ghost Doc
- http//www.roland-weigelt.de/ghostdoc/
- Snippet Designer
- http//www.codeplex.com/SnippetDesigner
- Yslow (Firebug Add-on)
- https//addons.mozilla.org/en-US/firefox/addon/184
3 - http//developer.yahoo.com/yslow/
22Questions
- Chris L Bennett
- chris.bennett_at_crowehorwath.com
- www.ChrisLBennett.com