Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Any method that has a type other than void must return an object of that type. So DisplayHeaders must return an integer array.</p> <pre><code>private static int[] DisplayHeaders(string[] headers) </code></pre> <p><code>private</code> - access modifier; indicates this method can only be called from within the class</p> <p><code>static</code> - static modifier; this method does not need an instance to be called</p> <p><code>int[]</code> - return type; this is the type of the object that this method will return</p> <p><code>DisplayHeaders</code> - method name; this is how you refer to this method</p> <p><code>(string[] headers)</code> - parameters; this indicates which arguments you need to pass to the method</p> <p>We can infer from the method summary that its implementation may look something like this:</p> <pre><code> /// &lt;summary&gt; /// Displays the column headers /// &lt;/summary&gt; /// &lt;returns&gt;returns an array of column widths&lt;/returns&gt; private static int[] DisplayHeaders(string[] headers) { // builds a new int array with the same // number of elements as the string array parameter int[] widths = new int[headers.Length]; for (int i = 0; i &lt; headers.Length; i++) { Console.WriteLine(headers[i]); // displays each header in the Console widths[i] = headers[i].Length; // populates the array with the string sizes } // the return keyword instructs the program to send the variable // that follows back to the code that called this method return widths; } </code></pre> <p>I would continue reading the chapter. More than likely the author fills in the implementation details of that method later on.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload