Sign In/My Account | View Cart  

advertisement

AddThis Social Bookmark Button

Article:
  Using the CodeDOM
Subject:   Clarification required regarding code in article
Date:   2003-03-12 05:39:35
From:   mangeshminal
Hi Nick,


Thank you very much for an interesting article.


While going thro' the article, I stumbled across 1 point - function for 'Initializing an Array'


In this function, CodePrimitiveExpression cpe is assigned as
cpe = CodePrimitiveExpression[Characters.Length];


Following this statement, there is a for loop which is used to create objects, for array of CodePrimitiveExpressions. This for loop is written as follows :
for (int i = 0; i < Name.Length ; i++)
{
cpe[i] = new CodePrimitiveExpression (Characters[i]);
}


My question is : What is the significance of Name.Length in for loop.


As per my understanding, for loop required to be as follows :
for (int i = 0; i < Characters.Length ; i++)
{
cpe[i] = new CodePrimitiveExpression (Characters[i]);
}


Will you please clarify my doubt ?


Waiting for your response...


Regards,
--- Shivprasad Mangesh Bhide

Full Threads Oldest First

Showing messages 1 through 1 of 1.

  • Clarification required regarding code in article
    2003-03-12 06:20:04  neh123us@yahoo.com [View]

    Sorry for the confusion. You are correct. The for loop should be structured like:

    for (int i = 0; i < Characters.Length ; i++)
    {
    cse[i] = new CodePrimitiveExpression (Characters[i]);
    }

    Let me know if you have any additional questions, or see any other problems.
    Nick