AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Array-Properties in C#

Ein Thema von Neutral General · begonnen am 19. Feb 2009 · letzter Beitrag vom 19. Feb 2009
Antwort Antwort
Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#1

Array-Properties in C#

  Alt 19. Feb 2009, 16:05
Hi,

Gibt es sowas wie:

property Items[Index: Integer]: TItem read GetItem write SetItem; in C#? Wenn ja, wie ist die Syntax davon?

Gruß
Neutral General
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
  Mit Zitat antworten Zitat
Dax
(Gast)

n/a Beiträge
 
#2

Re: Array-Properties in C#

  Alt 19. Feb 2009, 16:39
Code:
public Foo this[int idx] { get.. set.. }
Array-Properties können keine Namen haben, und alle Array-Properties sind automatisch default.
  Mit Zitat antworten Zitat
Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#3

Re: Array-Properties in C#

  Alt 19. Feb 2009, 16:52
Hi Dax,

Danke, so gehts
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
  Mit Zitat antworten Zitat
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
43.114 Beiträge
 
Delphi 12 Athens
 
#4

Re: Array-Properties in C#

  Alt 19. Feb 2009, 17:33
man kann also in C nur ein Array-Property (mit diesen Parametern) anlegen?
Garbage Collector ... Delphianer erzeugen keinen Müll, also brauchen sie auch keinen Müllsucher.
my Delphi wish list : BugReports/FeatureRequests
  Mit Zitat antworten Zitat
Dax
(Gast)

n/a Beiträge
 
#5

Re: Array-Properties in C#

  Alt 19. Feb 2009, 17:35
Du kannst in C# beliebig viele Array-Properties anlegen, solange sie alle unterschiedliche Parametersignaturen haben.
  Mit Zitat antworten Zitat
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
43.114 Beiträge
 
Delphi 12 Athens
 
#6

Re: Array-Properties in C#

  Alt 19. Feb 2009, 18:24
OK, aber nicht (so wie in Delphi ) mehrere mit der selben Parameter-Signatur
Garbage Collector ... Delphianer erzeugen keinen Müll, also brauchen sie auch keinen Müllsucher.
my Delphi wish list : BugReports/FeatureRequests
  Mit Zitat antworten Zitat
Dax
(Gast)

n/a Beiträge
 
#7

Re: Array-Properties in C#

  Alt 19. Feb 2009, 18:34
Das ist ja klar, wenn die Properties keine Namen haben. Allerdings kannst du dir sehr schnell benannte Arrayproperties bauen.
  Mit Zitat antworten Zitat
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
43.114 Beiträge
 
Delphi 12 Athens
 
#8

Re: Array-Properties in C#

  Alt 19. Feb 2009, 21:18
meinst du z.B. über Subklassen?
Garbage Collector ... Delphianer erzeugen keinen Müll, also brauchen sie auch keinen Müllsucher.
my Delphi wish list : BugReports/FeatureRequests
  Mit Zitat antworten Zitat
Dax
(Gast)

n/a Beiträge
 
#9

Re: Array-Properties in C#

  Alt 19. Feb 2009, 21:27
Zitat von himitsu:
meinst du z.B. über Subklassen?
Subklassen? Ich dachte da eher an Interfaces und protecterd in die eigentliche Klasse geschachtelte Structs, die das Interface implementieren und nichts weiter machen, als eine Arrayproperty an die umschließende Klasse durchzureichen.
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 08:33 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz