![]() |
args: array of const ?
Hallo !
ich analysiere gerade einen fremden Quelltext. Da kommt sowas vor:
Code:
das array of const hab ich noch nie gesehen und kann mir im Moment absolut nicht vorstellen, was und wozu das dienen soll ?
procedure tuwas(Value : Integer; args: array of const);
DAnke schonmal ! |
Re: args: array of const ?
so...
--------------------------------- The array of const construction is equivalent to array of TVarRec. TVarRec, declared in the System unit, represents a record with a variant part that can hold values of integer, Boolean, character, real, string, pointer, class, class reference, interface, and variant types. TVarRec’s VType field indicates the type of each element in the array. Some types are passed as pointers rather than values; in particular, long strings are passed as Pointer and must be typecast to string. --------------------------------- aus Delphi Hilfe....ganz einfach :stupid: :nerd: |
Re: args: array of const ?
Guck doch einfach mal in der Hilfe unter:
![]() |
Re: args: array of const ?
Ihr müsst ne andere Hilf als ich haben ! :-(
find ich nicht, egal .. lese aber gerade im Netz. Mal aber noch eine andere Frage dazu .. Hier ![]() lese ich den Satz: "Gegenüber C besitzten Pascal-Funktionen und -Prozeduren immer eine feste Anzahl von Parametern. Es gibt jedoch einen Weg, um eine variable Anzahl von Parametern an eine Routine zu übergeben, die Verwendung einen offenen Arrays." Besteht da ein Unterschied zwischen C# und C ?Also wie sieht das in C# aus ? |
Re: args: array of const ?
Zitat:
Code:
params darf nur für den letzten Parameter benutzt werden. Du kannst damit soviele Parameter übergeben wie du lustig bist. In der Methode landet es als Array.
using System;
internal class Program { static void PrintSomeWords(params string[] someWords) { foreach (string word in someWords) Console.WriteLine(word); } public static void Main(string[] args) { PrintSomeWords("eins", "zwei", "drei"); } } Ein gutes Beispiel ist:
Code:
string.Format("{0}, {1}, {2}",
"eins", "zwei", "drei"); |
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:31 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz