AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Programmieren allgemein c# sruct mit string inhalt nach delphi
Thema durchsuchen
Ansicht
Themen-Optionen

c# sruct mit string inhalt nach delphi

Ein Thema von KodeZwerg · begonnen am 11. Jan 2022 · letzter Beitrag vom 11. Jan 2022
Antwort Antwort
Benutzerbild von KodeZwerg
KodeZwerg

Registriert seit: 1. Feb 2018
3.685 Beiträge
 
Delphi 11 Alexandria
 
#1

c# sruct mit string inhalt nach delphi

  Alt 11. Jan 2022, 11:27
ich zerbreche mir gerade den kopf wie man so etwas nach delphi bringt
Delphi-Quellcode:
static struct foobar foobar[]=
{
    {"string0",0}
,
    {"string11 ",11},
    };
mein erster versuch sah so aus (weil dort static steht nahm ich const) aber ist wohl falsch da es ein record sein müsste
Delphi-Quellcode:
const
  foobar : array[0..11] of String = (
    'string0', // 0
    '', // 1
    '', // 2
    '', // 3
    '', // 4
    '', // 5
    '', // 6
    '', // 7
    '', // 8
    '', // 9
    '', // 10
    'string11//11
    );
und es als record umzuwandeln da scheitere ich an der zuweisung des string inhalts
Delphi-Quellcode:
type
  foobar = record
    foobar : record
      case integer of
         0: (string);
        11: (string);
    end;
  end;
Hat jemand einen Rat?
Gruß vom KodeZwerg
  Mit Zitat antworten Zitat
Benutzerbild von himitsu
himitsu

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

AW: c# sruct mit string inhalt nach delphi

  Alt 11. Jan 2022, 12:21
CASE : das ist "alternativ", also das Eine ODER das Andere, aber niemals Beides.

Delphi-Referenz durchsuchenTDictionary<>
Garbage Collector ... Delphianer erzeugen keinen Müll, also brauchen sie auch keinen Müllsucher.
my Delphi wish list : BugReports/FeatureRequests
  Mit Zitat antworten Zitat
BerndS

Registriert seit: 8. Mär 2006
Ort: Jüterbog
480 Beiträge
 
Delphi 11 Alexandria
 
#3

AW: c# sruct mit string inhalt nach delphi

  Alt 11. Jan 2022, 12:33
Würde das helfen?
Delphi-Quellcode:
const
  cFooBar: array [0..11] of record
     Value: string;
     ValueOrd: Byte;
    end = (
     (Value : 'String0'; ValueOrd:0),
     (Value : ''; ValueOrd:0),
     (Value : ''; ValueOrd:0),
     (Value : ''; ValueOrd:0),
     (Value : ''; ValueOrd:0),
     (Value : ''; ValueOrd:0),
     (Value : ''; ValueOrd:0),
     (Value : ''; ValueOrd:0),
     (Value : ''; ValueOrd:0),
     (Value : ''; ValueOrd:0),
     (Value : ''; ValueOrd:0),
     (Value : 'String11'; ValueOrd:11));
Bernd
  Mit Zitat antworten Zitat
Benutzerbild von KodeZwerg
KodeZwerg

Registriert seit: 1. Feb 2018
3.685 Beiträge
 
Delphi 11 Alexandria
 
#4

AW: c# sruct mit string inhalt nach delphi

  Alt 11. Jan 2022, 13:02
Würde das helfen?
In der Tat!
Ich bin auch schon etwas weiter gekommen aber deines schaut besser aus

Delphi-Quellcode:
type
  TFooBar = record
    name: PChar;
    level: Integer;
  end;
const
  FooBar: array of TFooBar = (
    (name:'string0'; level:0),
    (name:'string11'; level:11)
  );
Gruß vom KodeZwerg
  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 11:59 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