hi !
@Atomschwammerl: wie wärs mit einem guten buch zu C# ?
kann dir "Visual C# Schritt für Schritt" von Microsoft Press sehr empfehlen. Will hier keine werbung für MS machen, aber mit dem Buch hab ich angefangen, C# zu lernen und es ist imho. gut, weil man laufen Beispiele programmiert - also nicht nur einfach was liest, sonder das auch immer gleich ausprobiert.
(so merkt man sich dinge imho am besten)
@Cyres-X1:
string strTest = string.Format("Das {0} wird ein dynamischer {1} string", variable1, variable2);
typen werden automatisch erkannt, formatierungen kann man, wenn gewünscht angeben - näheres: siehe MSDN hilfe.
dort liest man auch folgendes (kopieren einer datei):
PHP-Code:
[C#]
using System;
using System.IO;
class Test
{
public static void Main()
{
string path = @"c:\temp\MyTest.txt";
string path2 = path + "temp";
try
{
// Create the file and clean up handles.
using (FileStream fs = File.Create(path)) {}
// Ensure that the target does not exist.
File.Delete(path2);
// Copy the file.
File.Copy(path, path2);
Console.WriteLine("{0} copied to {1}", path, path2);
// Try to copy the same file again, which should succeed.
File.Copy(path, path2, true);
Console.WriteLine("The second Copy operation succeeded, which was expected.");
}
catch
{
Console.WriteLine("Double copy is not allowed, which was not expected.");
}
}
}
fg
-hannes