Delphi-PRAXiS
Seite 1 von 2  1 2      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   C# Inttostr int C# (https://www.delphipraxis.net/63471-inttostr-int-c.html)

KuH_am_SchuH 19. Feb 2006 12:53


Inttostr int C#
 
Hallo zusammen,
wie heißt denn inttostr bei c# ????

zum beispiel

...
{
int a;
a = 2 ;

label1.text = a } : geht ja nicht

Jelly 19. Feb 2006 12:56

Re: Inttostr int C#
 
In .NET ist der Integer selbst eine Klasse... Umwandlung geht z.B. a.ToString

KuH_am_SchuH 19. Feb 2006 13:08

Re: Inttostr int C#
 
so^^?

{
int a;
a = 2;
textBox1.Text = a.ToString;
}

nur bei mir ging des nicht :(

Neutral General 19. Feb 2006 13:10

Re: Inttostr int C#
 
also ich muss zugeben das ich kaum Ahnung von .NET hab aber bei mir geht (zumindest in VB .NET)
Code:
cstr(Integer)

Khabarakh 19. Feb 2006 13:25

Re: Inttostr int C#
 
@Neutral General: Ieeeks :duck:
@Kuh am Schuh: C# ist bei Methoden konsequenter als Pascal, auch parameterlose Methoden benötigen ein Klammerpaar.

phXql 19. Feb 2006 13:33

Re: Inttostr int C#
 
Zitat:

Zitat von Neutral General
also ich muss zugeben das ich kaum Ahnung von .NET hab aber bei mir geht (zumindest in VB .NET)
Code:
cstr(Integer)

WAH! In .NET is alles objektorierniert, also einfach 1.ToString();

Neutral General 20. Feb 2006 16:32

Re: Inttostr int C#
 
Zitat:

Zitat von phXql
Zitat:

Zitat von Neutral General
also ich muss zugeben das ich kaum Ahnung von .NET hab aber bei mir geht (zumindest in VB .NET)
Code:
cstr(Integer)

WAH! In .NET is alles objektorierniert, also einfach 1.ToString();

In Visual Basic .NET geht das ! -.-

Khabarakh 20. Feb 2006 17:02

Re: Inttostr int C#
 
Für native VB-Umsteiger ist das vielleicht noch in Ordnung, aber das kann man doch unmöglich jemandem weiterempfehlen :stupid: . Zumal diese ganzen Artefakte natürlich nur in VB.NET nutzbar sind.

MagicAndre1981 20. Feb 2006 17:29

Re: Inttostr int C#
 
Zitat:

Zitat von Neutral General
In Visual Basic .NET geht das ! -.-

Ja, vb verkeitet ja auch zum schlechten Code schreiben, durch diese Kompatibilätsbefehle zu vb6 :wall:

ultrasombrero 20. Feb 2006 18:03

Re: Inttostr int C#
 
Zitat:

Zitat von phXql
WAH! In .NET is alles objektorierniert, also einfach 1.ToString();

"Einfacher" als IntToStr ist x.ToString bestimmt nicht, und schöner schon gar nicht.


Hier mal eine .NET Zeile, für die ich mich eine halbe Stunde durch das Netz schlagen musste, da die "Hilfe-Funktion" von Delphi 2005 einfach nur absolut unbrauchbar ist:

Delphi-Quellcode:
Label1.Text := Int32(Convert.ToInt32(TextBox1.Text) * Convert.ToInt32(TextBox1.Text)).ToString;

Im richtigen Delphi wäre das einfach:

Delphi-Quellcode:
Label1.Caption := IntToStr(StrToInt(Edit1.Text) * StrToInt(Edit1.Text));
Das ist nicht nur kürzer, sondern auch viel einfacher und logischer zu lesen.


Der ganze Objektorientiertheitswahn ist einfach Mist!


Alle Zeitangaben in WEZ +1. Es ist jetzt 02:51 Uhr.
Seite 1 von 2  1 2      

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