Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3357460
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:38:08+00:00 2026-05-18T02:38:08+00:00

I am reading MCTS Self Paced Training Kit (70-536) Edition 2 and in the

  • 0

I am reading MCTS Self Paced Training Kit (70-536) Edition 2 and in the 1st chapter we have the following.

How to Declare a Value Type Variable
To use a type, you must first declare
a symbol as an instance of that type.
Value types have an implicit
constructor, so declaring them
instantiates the type automatically;
you don’t have to include the New
keyword as you do with classes. The
constructor assigns a default value
(usually null or 0) to the new
instance, but you should always
explicitly initialize the variable
within the declaration, as shown in
the following code block:

'VB

Dim b As Boolean = False    

// C#  
bool b = false;

However, when I compile the following Console Application,

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Ch1_70_536
{
    class Program
    {
        static void Main(string[] args)
        {
            bool b;
            Console.WriteLine("The value of b is " + b);
            Console.ReadKey();
        }
    }
}

I get the Compile Time Error

“Use of Unassigned Local Variable b”

It is not even mentioned in the Errata. Am I doing something wrong or is the book completely wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T02:38:08+00:00Added an answer on May 18, 2026 at 2:38 am

    The book is mostly correct when it comes to VB, but it fails to mention the difference between VB and C# in this case.

    In VB all local variables are automatically initialised:

    Sub Test()
      Dim x As Integer
      MessageBox.Show(x.ToString()) 'shows "0"
    End Sub
    

    While in C# local variables are not initialised, and the compiler won’t let you use them until they are:

    void Test() {
      int x;
      MessageBox.Show(x.ToString()); // gives a compiler error
    }
    

    Also, it’s not clear whether the quote from the book is actually talking about local variables or class member variables. Class member variables are always initialised when the class instance is created, both in VB and C#.

    The book is wrong when it says that “Value types have an implicit constructor”. That is simply not true. A value type is initialised to its default value (if it’s initialised), and there is no call to a constructor when that happens.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am reading the MCTS Self-Paced Training Kit (Exam 70-536): Microsoft .NET Framework—Application Development
I am reading MCTS Self-Paced Training Kit for 70-433 exam. And it says that
I am preparing for MCTS exam 70-536 and reading the book MCTS self paced
I am preparing for MCTS 70-536, after reading this article. I am not 100%
reading the SCJP book, I've found something like this in the chapter 1 self-test
Reading Chomsky hierarchy ... ... I know regexp can't parse type-2 grammars (context-free grammars),
Reading or writing a C code, I often have difficulties translating the numbers from
Reading the book I found the following: The way of thinking when you model
Reading up on design patterns, and have found that there are 23(?) some-odd patterns
Reading through Thinking in Java i stuck in ex:6 of Inner Classes chapter. Exercise

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.