C# dynamic columns in CLR table-valued-function?

Hello,

I have a C# CLR table value function that is working great, but I've encountered an issue that I hope that you can help me resolve.  I have attached the signature for my method here.  The fields that you see listed work great and are always of interest, but...  Here is the rub...  There are a variable number of other fields that I would like to push out as part of the row in FillRow, but all the documentation that I've seen say nothing about having a variable number of fields.  Is it possible?  As I understand it, the TableDefinition is only used by Visual Studio for deploying the assembly, and the FillRow method is responsible for emiting the row of data.  So...  I guess there are two related questions:

1) Can the FillRow method use a variable argument list?
2) Is there a way to provide variable arguments to the TableDefinition?

Background:
I have a 2x2 matrix that I need to include as part of the returned row of data from this table value function.  The number of rows and/or columns can vary, so you can see why hard coding field names in the signature is an issue.  I am trying to find a way to output a variable number of fields.
[SqlFunction(DataAccess = DataAccessKind.Read, FillRowMethodName = "FillRow", TableDefinition =
            " [FullName] [nvarchar] (100), " +
            " [EmployeeId] [bigint], " +
            " [RegularHours] [decimal](8, 2), " +
            " [OvertimeHours] [decimal](8, 2), " +
            " [HolidayHours] [decimal](8, 2), " +
            " [LeaveHours] [decimal](8, 2), " +
            " [InsuranceCopay] [decimal](8, 2), " +
            " [RegularHourlyRate] [decimal](8, 2), " +
            " [OvertimeHourlyRate] [decimal](8, 2) "
        )]

Open in new window

mjgardneAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mjgardneAuthor Commented:
Something like this???  I know that it is not valid code... But a place from which to start...

public static void FillRow(Object theData, out params object[] varargs)
{
     
}
0
mjgardneAuthor Commented:
It cannot be done...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.