Thread View: borland.public.delphi.language.delphi.dotnet
5 messages
5 total messages
Started by VT Venkatesh
Sat, 26 Jul 2008 14:41
StringBuilder class -Is this a Bug
Author: VT Venkatesh
Date: Sat, 26 Jul 2008 14:41
Date: Sat, 26 Jul 2008 14:41
16 lines
1659 bytes
1659 bytes
When i try 3 parameters with StringBuilder.AppendFormat it compiles ok.
How ever when i try with four or more parameters it gives the error message
[DCC Error] uUserSearch.pas(227): E2034 Too many actual parameters
The code I have used is
**************************************************
//strBldFile is of tyep StribgBuilder
srchFile.m_Contents := strBldFile.AppendFormat('{0} {1} {2} {3}
','a','a','a','a').ToString.Trim;
*****************************************
I am using RS 2007 with Dec update in an asp.net application
The C# code compiles fine in VS
srchFile.Contents = strBldFile.AppendFormat("{0} {1} {2} {3}",
srchFile.Contents, srchFile.Description, srchFile.Keywords,
srchFile.Title).ToString().Trim();
Venkatesh
Re: StringBuilder class -Is this a Bug
Author: Robert Giesecke
Date: Sat, 26 Jul 2008 15:56
Date: Sat, 26 Jul 2008 15:56
18 lines
1778 bytes
1778 bytes
VT Venkatesh wrote:
> When i try 3 parameters with StringBuilder.AppendFormat it compiles ok.
> How ever when i try with four or more parameters it gives the error message
> [DCC Error] uUserSearch.pas(227): E2034 Too many actual parameters
> The code I have used is
> **************************************************
> //strBldFile is of tyep StribgBuilder
> srchFile.m_Contents := strBldFile.AppendFormat('{0} {1} {2} {3}
> ','a','a','a','a').ToString.Trim;
> *****************************************
>
It seems, that D.Net still has no support for the ParamArrayAttribute. Thus you have to pass these
arguments as an inline array.
sb.ApendFormat('{0} {1} {2} {3}',
['a', 'b', 'c', 'd']);
Funny though, you already did it in the other post of yours (the one with the escape sequences).
Re: StringBuilder class -Is this a Bug
Author: VT Venkatesh
Date: Sat, 26 Jul 2008 17:25
Date: Sat, 26 Jul 2008 17:25
13 lines
1445 bytes
1445 bytes
Robert Giesecke wrote:
>
> It seems, that D.Net still has no support for the ParamArrayAttribute.
> Thus you have to pass these arguments as an inline array.
> sb.ApendFormat('{0} {1} {2} {3}',
> ['a', 'b', 'c', 'd']);
>
> Funny though, you already did it in the other post of yours (the one
> with the escape sequences).
Thanks.I never thought i will have to do it every where.More over there
was no issue with 3 params.
venkatesh
Re: StringBuilder class -Is this a Bug
Author: Marc Rohloff [TeamB]
Date: Mon, 28 Jul 2008 12:37
Date: Mon, 28 Jul 2008 12:37
16 lines
1728 bytes
1728 bytes
On Sat, 26 Jul 2008 17:56:53 +0200, Robert Giesecke wrote:
> It seems, that D.Net still has no support for the ParamArrayAttribute. Thus you have to pass these
> arguments as an inline array.
> sb.ApendFormat('{0} {1} {2} {3}',
> ['a', 'b', 'c', 'd']);
I think they just chose to implement it in a way that was more
consistent with other variable parameter methods like System.Format.
The reason it works with up to 3 parameters is that AppendFormat is
overloaded.
--
Marc Rohloff [TeamB]
marc -at- marc rohloff -dot- com
Re: StringBuilder class -Is this a Bug
Author: Robert Giesecke
Date: Tue, 29 Jul 2008 05:22
Date: Tue, 29 Jul 2008 05:22
21 lines
1757 bytes
1757 bytes
Marc Rohloff [TeamB] wrote:
> On Sat, 26 Jul 2008 17:56:53 +0200, Robert Giesecke wrote:
>
>> It seems, that D.Net still has no support for the ParamArrayAttribute. Thus you have to pass these
>> arguments as an inline array.
>> sb.ApendFormat('{0} {1} {2} {3}',
>> ['a', 'b', 'c', 'd']);
>
> I think they just chose to implement it in a way that was more
> consistent with other variable parameter methods like System.Format.
>
The last parameter is marked with [ParamArray], which usually means that you can provide these values
as if they were parameters, instead of an array.
>
> The reason it works with up to 3 parameters is that AppendFormat is
> overloaded.
>
Yepp :-)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads