Overridable and Friend

by Sumant 31. July 2007 12:28

Owing to C++ background, I 'assumed' that C# has a keyword called 'Friend' and which is similar to 'Friend' in VB.NET. Well, my assumption was wrong. The C# equivalent of VB's 'Friend' is 'Internal'.

Well, this time I was converting a small snippet from C# to VB and so came across need of using 'Virtual' in VB. I had absolutely no clue, what this must be, but found after a little googling that its 'Overridable' which makes a method or property Virtual in VB.net.

[suggested reading]


Share   
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Tags: ,

.NET

"Differences Between Visual Basic .NET and Visual C# .NET" white paper

by Sumant 5. May 2007 11:52

There is a white paper on "Differences Between VB.NET ad VC#.NET" from Microsoft which can be downloaded from here.

Interesting enough to read, one of the related Microsoft's support kb article [kb308470] states :

Because of the previous differences between Visual Basic and C/C++, many
developers assume incorrectly about the capabilities of Visual Basic .NET. Many Visual Basic developers think that Visual C# is a more powerful language than Visual Basic. In other words, Visual Basic developers assume that you can do many things in Visual C# that you cannot do in Visual Basic .NET, just as there are many things that you can do in C/C++ but cannot do in Microsoft Visual Basic 6.0 or earlier. This assumption is incorrect.

Although there are differences between Visual Basic .NET and Visual C# .NET, both are first-class programming languages that are based on the Microsoft .NET Framework, and they are equally powerful. Visual Basic .NET is a true object-oriented programming language that includes new and improved features such as inheritance, polymorphism, interfaces, and overloading. Both Visual Basic .NET and Visual C# .NET use the common language runtime. There are almost no performance issues between Visual Basic .NET and Visual C# .NET. Visual C# .NET may have a few more "power" features such as handling unmanaged code, and Visual Basic .NET may be skewed a little toward ease of use by providing features such as late binding. However, the differences between Visual Basic .NET and Visual C# .NET are very small compared to what they were in earlier versions.

The "Differences Between Microsoft Visual Basic .NET and Microsoft Visual C# .NET" white paper describes some of the differences between Visual Basic .NET and Visual C# .NET. However, remember that the .NET Framework is intended to be language independent. When you must select between Visual Basic .NET and Visual C# .NET, decide primarily based on what you already know and what you are comfortable with. It is easier for Visual Basic 6.0 developers to use Visual Basic .NET and for C++/Java programmers to use Visual C# .NET. The existing experience of a programmer far outweighs the small differences between the two languages.No matter which language you select based on your personal preference and past experience, both languages are powerful developer tools and first-class programming languages that share the common languageruntime in the .NET Framework.


The white paper was published in Feb 2002 and has undergone revisions since then, latest being in April 2007. It is a 19 page MS Word document that has a similar introduction to above text from kb and fairly covers the basic differences that a VB/C# programmer must know.

 


 

Share   
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Tags: ,

.NET

Parameter Scope in C#

by Sumant 10. April 2007 22:26

By scope, here, I mean 'value' type or 'reference' type.

The parameters are passed almost as in VB.net, by default a parameter is passed as 'value' type (ByVal in VB.net). In C# we don't use any specifier to indicate a 'value' type parameter.

For reference types we have specifiers 'ref' and 'out' with a subtle difference between both, which is, all 'ref' parameters must be initialized before being passed as an argument while 'out' parameters need not, whereas, all 'out' parameters must be assigned a value before the method ends. Properties cannot be passed as reference type parameters.

A method can be overloaded by chaging parameter type from value to reference and vice versa. (note that a change by 'ref' to 'out' or vice versa will not overload a method)

For more on this and sample code check this on MSDN online.

 

 

Share   
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Tags: ,

.NET

More Differences ...

by Sumant 2. April 2007 12:34

In my previous post, I had mentioned about the quick difference reference page. Today I was looking for comparison options for a byte value in vb and did a search on Google for "comparing Byte value VB.net" and what I got was what I have been looking earlier with most significant keywords. Can you guess that? It gave me a list of sites that have quick reference guides or cheat sheets for C# and VB.net comparison. At times it makes me feel that after all what I am using is just a machine!

For your reference - some of the useful links from the list -
Complete Comparison for VB.NET and C#
VB.NET & C# comparision
C# and VB.NET Comparison Cheat Sheet

 

 

Share   
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Tags: ,

.NET

VB.NET and C# : quick - difference - reference

by Sumant 10. March 2007 09:16

Today I came across this nice web page where the author has consolidated most of the basic differences (and equivalents) between these languages. The list is quite exhaustive and the side by side display style is wonderful. A real quick reference guide for learners like me.

[visit quick reference guide page]

 

 

Share   
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Tags: ,

.NET

© 2008 Sumant Dubey

About this blog

Absolutely technical! The posts are about concepts, tricks, articles and links on technical subjects / problems which are not very obvious to understand / resolve. Purpose is to have this as the first-aid in the time of need.

Disclaimer

The opinions expressed on this website are my own personal opinions and do not represent my employer's view in anyway.