C# Visual Basic Bilingual Dictionary
Visual Studio 2015 Edition
Tim Patrick
C# Visual Basic Bilingual Dictionary
Visual Studio 2015 Edition
by Tim Patrick
Copyright 2015 by Tim Patrick. All rights reserved.
Published by Owani Press.
For updates to this book and information on other books published by Tim Patrick, contacthim online, via email, or through social media.
Website | wellreadman.com |
Email |
Facebook | facebook.com/wellreadman |
Twitter | twitter.com/thewellreadman |
Goodreads | goodreads.com/wellreadman |
Visit Owani Press online at OwaniPress.com .
Cover art by Kenneth Low.
To Claudette Moore
a friend to old trees and old technical book authors
Table of Contents
Introduction
The Two Languages
To paraphrase the renowned playwright George Bernard Shaw, C# and Visual Basic are two languages separatedby a common Framework. As for syntax and target audience, Microsofts two programming systems seem so distant fromeach other. Despite that separation, they are complete equals when it comes to coding power, computational access, and automationof tasks that users need every day.
VB claims as its grammatical lineage the first edition of BASIC, developed by John Kemeny and ThomasKurtz in 1964 as a means of bringing ease and clarity to the software development process. Five years later, Dennis Ritchiebegan work on the C programming languageC#s own progenitorcrafting a compiler that, according to itsauthor, was more convenient and effective for many tasks than supposedly more powerful languages.
In .NET, Microsoft brought together these two discrete computing dialectsthe simplicity ofone software language designed for mere mortals, and the strength of a second language created to solve a large range ofcoding problems, from device drivers to word processors. The descendants of BASIC and C now sit together on the common foundationof the .NET Framework. From this shared resource, developers in both C# and Visual Basic have access to the same tools,the same platforms, and the same user communities.
Yet they are not the same. Visual Basic code loathes curly braces, and you have to look long and hardto see things spelled out completely in C#. The languages share much in facilitating Rapid Application Development and harnessingpowerful technologies such as ADO.NET and XAML. But the way they communicate through source code is quite different. Thatswhere this book comes in.
The C#-Visual Basic Bilingual Dictionary helps unify Visual Basic and C# by providing clear,functional equivalents for all syntax and feature differences between the two languages. This linking of the two grammarshas never been more essential.
Who Needs this Book?
Decades ago, developers who cut their teeth on C and BASIC could build an entire career by stickingwith just one general-purpose language. Today, software houses demand that their programmers be fluent in multiple languages,scripts, data formats, and platforms, both mobile and desktop. If you already speak VB, theres a good chance youwill require some proficiency with C# as well, and vice versa.
The C#-Visual Basic Bilingual Dictionary is designed for all Visual Basic and C# developers,including those who only use one of those languages. The Internet contains a wealth of support content for .NET developers.However, searching online for an answer to some thorny Framework issue might produce results in that otherlanguage. Solving your coding problem may require you to act as a foreign-language translator, and having a good dictionaryby your side is a must.
This book is also a good resource for Visual Basic developers who target mobile devices with the VBCore reduced runtime library. VB Core programs lack access to many features in the Microsoft.VisualBasic and My namespaces. Often, these missing features can be replaced with language-agnostic.NET Framework library features, and in ways that happen to be identical to the equivalent C# implementation. If you dependon VB Core, locate the missing features in Chapter 2 and Chapter 3 of this text to find useful replacement logic.
This text is a reference work, and not a training manual. While it can teach you a lot about VisualBasic and C#, it is not organized in a way that would be convenient for those new to .NET programming in general. The bookassumes that you are at least partially familiar with one of the two languages, or with .NET programming.
Whats in the Book?
This reference book exists to make repeated jumps between Visual Basic and C# as painless and informativeas possible. Nearly 900 dictionary-like entries cover every keyword and most major grammar concepts found in the two languages.The entries appear in three language-specific chapters.
- Chapter 1 includes entries for all C# keywords and features, sorted by name. Each entry provides equivalent Visual Basic syntax and usage details for a specific C# construct.
- Chapter 2 reverses the process, supplying C# substitutes and details for each entry in a sorted list of Visual Basic keywords and features.
- Chapter 3 is an extension of Chapter 2, listing every member of Visual Basics My Namespace. Each entry documents C# code that allows you to perform the same task as the member in question.
New with Visual Studio 2015
The book includes full coverage of language features introduced with Visual Studio 2015 andthe Roslyn compiler. For developers who have not yet upgraded to the latest version, all discussions of newfeatures clearly indicate the functionality that existed prior to Visual Studio 2015.
Whats Not in the Book?
Although the C#-Visual Basic Bilingual Dictionary includes complete coverage of every languagekeyword and syntactic element in both C# and Visual Basic, it is not an exhaustive reference for .NET development. Exceptas they appear in specific coding solutions, the book does not discuss the .NET Base Class Libraries. It also excludes otherlanguage-neutral .NET technologies, such as ADO.NET and Windows Communication Foundation (WCF).
The name Visual Basic refers to the .NET version of the language only, and not to thoseeditions that culminated in Visual Basic 6.0. The book does identify differences between new language updates released withVisual Studio 2015 (Roslyn) and those that were in effect in Visual Studio 2013. However, it does not documentchanges introduced in prior releases of the C# and Visual Basic languages. For instance, the text assumes that asynchronousprogramming keywords (the async and await operators) already exist in each language, althoughthese keywords were not introduced until Visual Studio 2012.
Although Chapter 1 includes coverage of the dynamic C# languagekeyword, the book does not discuss the System.Dynamic namespace, nor any Dynamic LanguageRuntime features.
Acknowledgements
Reading a reference book from cover to cover is hard work, but several skilled developers across theglobe agreed to take the challenge, and the book is much improved as a result. Eric Moreau and Jan Zruba provided extensivecomments on the text. Additional input also came from David Fulop, Marcel Meijer, Fanie Reynders, and Alex Sorokoletov.Special thanks goes to Lucian Wischik and all of the Microsoft language MVPs, authors, and insiders who let me eavesdropand participate in their technical interactions.
About the Author
Tim Patrick is a software architect and developer with more than 30 years of experience in designingand building custom software solutions. He is also an author of books and articles, mostly on technical subjects. You areat this very moment enjoying his eighth book on software development.
Next page