Autor Beitrag
kostonstyle
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 94



BeitragVerfasst: Di 26.01.10 11:03 
Hallo miteinander
könntet ihr mir bitte erklären, was man zwischen [] hinschreibt?
oder was für eine bedeutung das hat?
ausblenden C#-Quelltext
1:
[DllImport("advapi32.dll", SetLastError = true)]					

gruss kostonstyle
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Di 26.01.10 11:14 
Hallo!

Das sind so genannte Attribute. Die benutzt man, um einem Element weitere Informationen "anzuheften". So legt man mit dem DllImportAttribute ja fest, dass die Methode, der man dieses Attribut anheftet, in einer Dll-Datei zu finden ist und daher im Quelltext selber nicht implementiert wird.

Grüße
Christian

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19339
Erhaltene Danke: 1752

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Di 26.01.10 11:16 
Ich seh schon die Box, da kann ich mir den Rest ja sparen. :D

Mehr dazu findet sich hier in der Doku:
msdn.microsoft.com/d...ibrary/48zeb25s.aspx