params-keyword

Is it possible to explode an array so that its elements can be passed to a method with the params keyword?

Take this non-compiling code for instance: public string GetPath(string basefolder, string[] extraFolders) { string version = Versioner.GetBuildAndDotNetVersions(); string callingModule = StackCrawler.GetCallingModuleName(); return AppendFolders(basefolder, version, callingModule, extraFolders); } private string AppendFolder...

Overloading operator << - C++

Background I have a container class which uses vector<std::string> internally. I have provided a method AddChar(std::string) to this wrapper class which does a *push_back()* to the internal vector. In my code, I have to add multiple items to the container some time. For that I have to use container.AddChar("First"); container.AddChar(...

Using C#'s xml comment cref attribute with params syntax.

In C#, I am trying to use <see cref="blah"/> to reference a method signature that contains the params keyword. I know this converts the parameter list to an array, but I can't even figure out how to refer to an array in a CREF attribute. I am finding nothing in my searches and no one I know has any idea, either. The compiler is chokin...

How to use complex Type params argument in Spring.NET constructor

I am trying to use Spring.NET with a C# application to populate a parameter array (params keyword) constructor argument that is of a complex Type (call it SecretCode, which happens to be an enumerated type.) Can someone help point me to the documentation to configure the XML file to do this? For reference, here are relevant code snippe...

Overloading, generic type inference and the 'params' keyword

Hi, I just noticed a strange behavior with overload resolution. Assume that I have the following method : public static void DoSomething<T>(IEnumerable<T> items) { // Whatever // For debugging Console.WriteLine("DoSomething<T>(IEnumerable<T> items)"); } Now, I know that this method will often be called with a small numb...

How can I tell the number of replacements in a formatter string?

Given the following method: (real method has a few more parameters, but the important ones are below...) public string DoSomething(string formatter, params string[] values) { // Do something eventually involving a call to String.Format(formatter, values); } Is there a way to tell if my values array has enough objects in it to cov...

Can I use params in Action or Func delegates?

When I'm trying to use params in an Action delegate... private Action<string, params object[]> WriteToLogCallBack; I received this design time error: Invalid token 'params' in class, struct, or interface member declaration Any help! ...