Guest User

Guest User

  • Tech Writer
  • 357
  • 120.9k

Syntax meaning

Jul 25 2012 5:34 PM
Hi,

Given the following code example.

public string AddSomethingMethod(string templateName)

return GetString(new object[] { templateName  });

From what I know, object[] is an array of objects.

However the reference being passed in is of type string (singular) and not an array of strings.

The GetString method accepts a parameter of params object[] args.

And the logic does the following:-

for(int i = 0; i < args.Length; i++)  

string str1 = args[i] as string;         

if(str1 != null) || str1.Length > 0x400     

args[i] = str1.Substring(0, 0x3fd) + "...";

return args;

From this I gather that the string being passed in, is broken down into chars hence why the object array is used?

Regards

Steven





Answers (12)