Skip to main content
Minor edit: grammar/spelling/case/punctation/etc.
Source Link
Peter Mortensen
  • 31.4k
  • 22
  • 110
  • 134

How about theThe params keyword, i.e.

public void DoSomething(params string[] theStrings)
{
  foreach(string s in theStrings)
  {
    // Something with the Strings…
  }
}

Called like

DoSomething(“The”, “cat”, “sat”, “on”, “the” ,”mat”);

How about the params keyword i.e.

public void DoSomething(params string[] theStrings)
{
  foreach(string s in theStrings)
  {
    // Something with the Strings…
  }
}

Called like

DoSomething(“The”, “cat”, “sat”, “on”, “the” ,”mat”);

The params keyword, i.e.

public void DoSomething(params string[] theStrings)
{
  foreach(string s in theStrings)
  {
    // Something with the Strings…
  }
}

Called like

DoSomething(“The”, “cat”, “sat”, “on”, “the” ,”mat”);
added 31 characters in body
Source Link
George Mauer
  • 122.9k
  • 140
  • 401
  • 632

How about the params keyword i.e.

public void DoSomething(params string[] theStrings)
{
  foreach(string s in theStrings)
  {
    // Something with the Strings…
  }
}
 
Called like


Called like

DoSomething(“The”, “cat”, “sat”, “on”, “the” ,”mat”);

How about the params keyword i.e.

public void DoSomething(params string[] theStrings)
{
  foreach(string s in theStrings)
  {
    // Something with the Strings…
  }
}
 
Called like


DoSomething(“The”, “cat”, “sat”, “on”, “the” ,”mat”);

How about the params keyword i.e.

public void DoSomething(params string[] theStrings)
{
  foreach(string s in theStrings)
  {
    // Something with the Strings…
  }
}

Called like

DoSomething(“The”, “cat”, “sat”, “on”, “the” ,”mat”);
Source Link
Tim Jarvis
  • 18.9k
  • 11
  • 62
  • 95

How about the params keyword i.e.

public void DoSomething(params string[] theStrings)
{
  foreach(string s in theStrings)
  {
    // Something with the Strings…
  }
}

Called like


DoSomething(“The”, “cat”, “sat”, “on”, “the” ,”mat”);
Post Made Community Wiki by CommunityBot