Kamis, 12 Juli 2018

Sponsored Links

Comparing passing variables ByVal and ByRef (By Value and By ...
src: i.ytimg.com

C # and Visual Basic.NET are the two main languages ​​used for programming on the.NET Framework.


Video Comparison of C Sharp and Visual Basic .NET



Riwayat bahasa

C # and VB.NET are languages ​​that are syntactically very different from very different histories.

As the name suggests, the C # syntax is based on C core programming language originally developed by Dennis Ritchie at Bell Labs (AT & amp; T) in the 1970s. Java and C are two other programming languages ​​whose syntax is also based on the C syntax, so they share the same look and feel. See Comparison of Java and C Sharp for more on this topic.

BASIC roots go back to Dartmouth College. BASIC (Beginner's All-purpose Symbolic Instruction Code) was developed in the 1960s as a method to overcome difficulties using ASSEMBLY language written for specific processors and/or key frameworks and brand name hardware. As you can remember, programming is hardware that relies more on design for marketing reasons rather than maintaining the logical composition of programming that should go beyond hardware. (Microsoft claims to be famous for its operating system is to free consumers of hardware-specific devices by encapsulating those tasks in its operating system.) The code becomes "portable" because of the compiler, and in fact both BASIC AND CSHARP use the same CLR (Common Language Runtime ) today. Microsoft and HP are interested in creating an ISO standard language, which is the original goal, however; HP dropped its support, and ISO computer languages ​​never materialized as International Standards.

VB.NET has its roots in the 60's BASIC language with the name being the acronym for "Symbolic Instruction Code All Beginner Objectives". Initially, BASIC was used in the college community as the "basic" language for the first exposure to computer programming and acronyms represented language accurately. In the 70s, language was taken by microcomputer manufacturers from an era that would be used both as a simplified ROM programming language as well as a fake operating system for input/output control. In the early '80s, this language was picked up by Microsoft and expanded significantly beyond its original intent into their "Visual Basic" language/platforms that were sold throughout the 1990s as a "quick app development" (RAD) tool for Windows programming. It competed directly against other RAD tools from the 1990s such as PowerBuilder. Although Visual Basic was a successful development platform, it was discontinued after the 6th (VB6) version when Microsoft introduced the.NET Framework and related Visual Studio development platforms in the early 2000s. At that time, C and VB6 languages ​​are currently used by Microsoft as the basis for two new programming languages ​​in their new "Integrated Development Environment (IDE)". These languages ​​are named C # and VB.NET

In February 2017, Microsoft communicated their intention to end the "co-evolution" strategy between two languages ​​that have existed since 2010, and allows two languages ​​to evolve independently. C # is now the dominant Microsoft-based development language. Developers will notice that VB 15 (first appeared in Visual Studio 2017) does not have the specific language capabilities contained in the new C # 7.

Maps Comparison of C Sharp and Visual Basic .NET



Language comparison

Although C # and VB.NET are syntactically very different, that is where the difference is largely over. Microsoft developed these two languages ​​to be part of the same.NET Framework development platform. They are both developed, managed, and supported by the same language development team at Microsoft. They are compiled into the same intermediate language (IL), which runs against the same.NET Framework runtime libraries. Although there are some differences in the construction of programming (discussed further below), their differences are mainly syntactic and, assuming one avoids the Visual Basic "Compatibility" library provided by Microsoft to assist the conversion of VB6, almost every command in VB has commands equivalent in C # and vice versa. Finally, the two languages ​​reference the same Basic Class of the.NET Framework to extend their functionality. As a result, with some exceptions, programs written in either language can be run through a simple syntax converter to translate to another. There are many open sources and commercially available products for this task. The only fundamental difference between languages ​​can be found in interface implementations and in declarations, raising and handling events. Although both languages ​​are high-level programming languages, VB.NET maintains a slightly higher level of abstraction in some respects.

VB.net} Difference Between 2 Dates/Times-Timespan Tutorial - YouTube
src: i.ytimg.com


Support multi-language runtime

One of the main goals. NET is its multi-language support. The purpose of the design is that all of the various Microsoft languages ​​must have the same level of access to all OS features, should be able to expose the same level of power and usability, and simplify calls from modules in one language to those written in other languages.

In its implementation, all programming languages. NET share the same runtime engine, a uniform abstract syntax tree, and Common Intermediate Language. Other than that. NET languages ​​have access to platform features including garbage collection, cross-language inheritance, exception handling, and debugging. This allows the same binary output to be generated from the.NET programming language.

Custom VisualStudio 2008-style MenuStrip and ToolStrip Renderer in ...
src: i35.tinypic.com


Development environment

Visual Studio provides a small difference in the development environment for C # and VB.Net. With each subsequent Visual Studio release, the difference between the development environment for this language has been reduced. For example the initial version of Visual Studio has poor support for Intellisense in C # compared to Visual Basic.NET, and does not offer background compilation for C #. Currently, the main difference in the development environment is an additional feature for Visual Basic.NET derived from VB6, including:

  • Default namespaces are hidden (but can be disabled)
  • Certain project files are hidden (users can display them)
  • Namespace My. * generated automatically contains many commonly used shortcuts that are brought in from VB6, such as methods to operate in registry and application files

Background compilation is a feature of Visual Studio IDE where the code is compiled as written by the programmer with the purpose of identifying compile errors without requiring a solution to be built. This feature has been available for Visual Basic since.NET 1.1 and is present in early versions of Visual Studio for Visual Basic.NET. However, background compilation is a relatively new concept for Visual C # and is available with Service Pack 1 for Visual Studio 2008 Standard Edition and above. A different disadvantage for C # is that the Error List panel does not update until the solution is rebuilt. Refactoring large projects in C # is made more difficult by the need to frequently rebuild solutions to highlight compilation errors. As is the case with Visual Basic because the Error List panel is synchronized with a background compiler.

Background compilation is less demanding on system resources and results in faster build cycles. This is a special advantage with large projects and can significantly reduce the time it takes to start debugging in the IDE.

C# Tutorial 0 - Difference Between C and C# - YouTube
src: i.ytimg.com


Language features

Although the default is for Option Strict to go for backward compatibility reasons, it is recommended by Microsoft and is widely regarded as a good practice to turn Option Strict on, due to the fact that it improves application performance and reduce the possibility of naming errors and other programming errors.

  • Val () function that also parses the null value when converting to double (In c # Convert.ToDouble () is used to convert any object into the value of a double type, but that throws an exception in the case of a zero value)
  • CInt, CStr, CByte, CDbl, CBool, CDate, CLng, CCur, CObj, and various conversion functions built in

Other characteristics of C # do not apply to Visual Basic.NET

  • By default, numeric operations are not checked. This results in a slightly faster code, at the risk that numerical overflows will not be detected. However, the programmer can place arithmetic operations into a checked context to enable overflow checking. (This can be done in Visual Basic by checking the option)
  • The C # identifier is case sensitive.
  • To set the same value to multiple variables, you can use a = b = c

Difference between vb & c# tutorial - YouTube
src: i.ytimg.com


Syntax comparison

Visual Basic.NET ends the block of code with a more familiar statement of End BlockName (or Next , for a for loop) for a programmer with experience using T -SQL. In C #, brackets, {} , are used to restrict blocking, which is more familiar to programmers with experience in other widely used languages ​​such as C and Java. In addition, in C # if the block consists of only one statement, braces can be removed.

C # is case sensitive whereas Visual Basic.NET does not. So in C # it is possible to have two variables with the same obvious name, for example variable1 and Variable1 . Visual Studio will correct (create uniform) case variables as typed in VB.NET. But in some cases, case sensitivity can be useful. Programmer C usually uses capital letters and member names and leaves the field and the variable name of lower case. This allows, for example, the naming of a fairly natural argument method: public int CalculateOrders (Subscribers) . However, this can cause problems for those who convert C # code into non-case sensitive languages, such as Visual Basic, or for those unfamiliar with language-sensitive languages.

Keyword

Visual Basic is not case sensitive, which means that any combination of uppercase and lowercase in keywords is acceptable. Visual Studio automatically converts all of the Visual Basic keywords into standard case letters, such as "Public", "If".

C # is case-sensitive and all C # keywords are in lowercase.

Visual Basic and C # share most of the keywords, with the difference being that the default default Visual Basic is the uppercase version of the C # keyword, e.g. Public vs public , If vs if .

Some keywords have very different versions in Visual Basic and C #:

  • Friends vs internal - the access modifier allows inter-class references but not inter-assemblies, except for friend packs
  • Me vs this - a standalone reference to the current object instance
  • MustInherit vs abstract - prevents a class from being instantly instantiated, and forces the consumer to create object references only to the derived class
  • MustOverride vs abstract - to force the derived class to override this method
  • MyBase vs base - to refer to the base class from which the current class is derived
  • NotInheritable vs sealed - to declare a class that may not be inherited
  • NotOverridable vs sealed - to declare methods that can not be overwritten by derived classes
  • Overridable vs virtual - declare a method that can be overridden in derived class
  • Overrides vs override - to mark virtual methods as overrides
  • Shared vs static - to declare methods that do not require explicit object instances

Some C # keywords like sealed represent different things when applied to methods that conflict with when applied to class definitions. VB.NET, on the other hand, uses different keywords for different contexts.

Comment

Conditionals

Loops

Comparers

Primitive type

Type object


Why Prefer C# against Other Programming Languages?
src: www.csharpens.com


Adoption support and community

Both C # and VB.NET have high adoption rates, and a very active developer community and Microsoft fully supports both communities. The.NET Framework developer extensively uses VB.NET and C # as the primary language. However, C # has more community activity on the Internet and there are more books available for C #. This may indicate that there is more C # adoption or that users need more help for it.

Examples of community and industry adoption include:

  • The TIOBE Programming Community Index for July 2010 shows that C # goes beyond Visual Basic
  • The original C # language designer, Scott Wiltamuth, stated in a March 2010 blog that "the most reliable figures we have... show almost identical adoptions" for VB.NET and C #.
  • The 2007 Forrester Research poll revealed that 59% of NET developers use just VB.NET to create software.
  • Visual Basic Express is the most popular download of all Visual Studio Express downloads.
  • According to a November 2007 survey by Visual Studio Magazine "41 percent said they used C #, 34 percent were programmed in VB.NET, while 25 percent responded with 'other.' "
  • Stephen Wiley, marketing product manager at Apress has reported "the title of C # sells more VB.NET titles easily, with somewhere between the 2-1 and 3-1 margins."
  • MSDN Blogs, a blogging site for Microsoft employees, has 770,000 posts covering C #, while only 378,000 mention VB.Net (starting Feb 04, 2016)
  • The Google Group, Usenet search engine, generates 35.2 million clicks for "VB.Net" and 244,000,000 for "C #" (starting Feb 04, 2016)
  • The developer Survey of the Stumble Overflow 2018 developer states that 35% of professional developers use C # while only 6.9% use VB.NET.

VB net} Difference Between 2 Dates Times Timespan Tutorial - YouTube
src: i.ytimg.com


Other languages ​​

C/CLI (formerly Managed C)

C/CLI (replacement for Managed Extensions for C) does not have a C # or VB.NET adoption rate, but has significant followers. C/CLI syntactically, stylistically, and cultural is the closest to C #. However, C/CLI remains closer to the root of C than C #. C/CLI directly supports pointers, destructors, and other unsafe program concepts that are not supported or limited in other languages. This allows the direct use of both.NET code and the standard C code. C/CLI is used to port native/legacy C applications into.NET frameworks, or cases where programmers want to take more control of the code; but these controls come with significant ease of use and readability costs. Many of the automated tools that come with Visual Studio have reduced functionality when interacting with C code. This is because reflection can not provide as much information about code as it can be done for C # and VB.net

J #

J # runs a distant fourth in terms of adoption. J # is a language primarily designed to facilitate the transition of Java applications to the.NET framework; it allows developers to leave most Java or J code unchanged while still running it in.NET framework, allowing them to migrate small pieces to other.NET languages, such as C #, individually. J # does not receive the same level of updates as other languages, and does not have the same community support level. For example, Visual Studio Team System 2005 supports automated Unit Testing in C #, VB.Net, and C, but excluding J #. J # has been discontinued and is not included in Visual Studio 2008 or later versions, because the existing J # features mostly meet customer needs and the use of J # decreases.

Additional.NET languages ​​

All.NET languages. Compiles into Common Intermediate Language (CIL), which contains rich metadata and is functionally and logically equivalent to the original.NET language code. For this reason, while it is possible to code directly in CIL, it is rarely done. The equivalence of CIL language code to.NET allows tools like.NET Reflector to convert.NET assembly into source code almost identical to the original source. Code obfuscators are often used to guard against this, and operate by directly modifying the CIL of an assembly to make it difficult or impossible to de-compile to a higher level. NET language.

C# Fundamentals with Visual Studio 2015 | Pluralsight
src: pluralsight.imgix.net


References


Learning C# for VB.net Programmers - Introduction - YouTube
src: i.ytimg.com


External links

  • Microsoft Visual Studio Language Comparison in details
  • Microsoft Visual Studio Language Equals 2003-2010
  • Microsoft VSTO Programming with Visual Basic Versus C #
  • CodeProject VB vs C #
  • Syntactic differences between C # and VB.NET

Source of the article : Wikipedia

Comments
0 Comments