1. Computing

Does this Microsoft Example Make Sense To You?

By August 4, 2012

Follow me on:

Check out the example at Microsoft's page about the String.Clone Method. A snippet of the code there ...

' Create a Unicode String
'
with 5 Greek Alpha characters
Dim szGreekAlpha As New String(
     ChrW(&H0391), 5)
' Create a Unicode String
' with a Greek Omega character

Dim szGreekOmega As New String(New Char() {
     ChrW(&H03A9), ChrW(&H03A9),
     ChrW(&H03A9)}, 2, 1)

This is possibly the worst example of Microsoft documentation I have encountered. (And that's saying something.) And it's used many times to document the different versions of .NET.  Here's just a few of the things wrong with it:

1 - Greek letters have absoutely nothing to do with what they're explaining.

2 - It's totally unnecessary to use things like Unicode characters expressed as Hexadecimal numbers and an obscure New constructor that picks the second element from an inline array. Why do they do those things?

3 - They never explain any of it or even tell you what the result should be. To see that, you have to copy it into your own environment and run it.

But the most egregious fault is ... It doesn't tell you anything about String.clone! (Except maybe basic syntax ... and that's shown earlier.)

Can anyone tell me what I'm missing?

In any case, this was one reason I wrote a new article for the site: Copying Reference Types. Hopefully, this article explains it.

Comments
Comments are closed for this post.
Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>
  1. About.com
  2. Computing
  3. Visual Basic

©2014 About.com. All rights reserved.