<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: fr_tandu</title>
    <description>The latest articles on DEV Community by fr_tandu (@fr_tandu).</description>
    <link>https://dev.to/fr_tandu</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F316747%2F1d9f45b5-b1b6-4de4-8baa-408caeeeb5fe.JPG</url>
      <title>DEV Community: fr_tandu</title>
      <link>https://dev.to/fr_tandu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fr_tandu"/>
    <language>en</language>
    <item>
      <title>C# internal parameters</title>
      <dc:creator>fr_tandu</dc:creator>
      <pubDate>Wed, 12 Aug 2020 22:38:09 +0000</pubDate>
      <link>https://dev.to/fr_tandu/c-internal-parameters-d7c</link>
      <guid>https://dev.to/fr_tandu/c-internal-parameters-d7c</guid>
      <description>&lt;p&gt;So, let's consider a class, with a public method, that calls private methods:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//Parameter method

public class Doer
{
   public bool somethingDoer(int x)
   {
      doSomething(x);
      doAnotherThing(x);
      doYetAnotherThing(x);
      doSomethingElse(x);
      return true;
   }
   private void doSomething (int y)
   {
      //does something
   }
   private void doAnotherThing(int z)
   {
      //does another thing
   }
   private void doYetAnotherThing(int u)
   {
      //does Yet another thing
   }
   private void doSomethingElse(int p)
   {
      //does something else
   }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Is it better to have the x variable as a parameter passed, or a class variable assigned when calling when calling the method? Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//Class Variable Method

public bool somethingDoer(int x)
{
   _internalInt = x;
   doSomething();
   doAnotherThing();
   doYetAnotherThing();
   doSomethingElse();
   return true;
}
private void doSomething ()
{
   //does something with _internalInt
}
etc...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;When  you call `Doer.somethingDoer(5);', you'll get the same result, I'm just wondering from the perspective of design/testing, which is a better way to go? Parameter, or Class Variable?&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>todayisearched</category>
    </item>
  </channel>
</rss>
