Vereinfachung ?

  • Hallo stagetwo,


    gibt es hierfür eine einfache Lösung , wo ich nicht alles in der Console.Writeline eintragen muss ?
    [cs] SqlDataReader reader = command_new.ExecuteReader();
    while (reader.Read())
    {
    int service = reader.GetInt32(0);
    int ID = reader.GetInt32(1);
    string CodeName128 = reader.GetString(2);
    string ObjName128 = reader.GetString(3);
    string OrgObjCodeName128 = reader.GetString(4);
    //string NameStrID128 = reader.GetString(5);
    //string DescStrID128 = reader.GetString(6);
    //int CashItem = reader.GetInt32(7);
    //int Bionic = reader.GetInt32(8);
    //int TypeID1 = reader.GetInt32(9);
    //int TypeID2 = reader.GetInt32(10);
    //int TypeID3 = reader.GetInt32(11);
    //int TypeID4 = reader.GetInt32(12);
    //int DecayTime = reader.GetInt32(13);
    //int Country = reader.GetInt32(14);
    //int Rarity = reader.GetInt32(15);
    //int CanTrade = reader.GetInt32(16);
    //int CanSell = reader.GetInt32(17);
    //int CanBuy = reader.GetInt32(18);
    //int CanBorrow = reader.GetInt32(19);
    //int CanDrop = reader.GetInt32(20);
    //int CanPick = reader.GetInt32(21);
    //int CanRepair = reader.GetInt32(22);
    //int CanRevive = reader.GetInt32(23);
    //int CanUse = reader.GetInt32(24);
    //int CanThrow = reader.GetInt32(25);
    //int Price = reader.GetInt32(26);
    //int CostRepair = reader.GetInt32(27);
    //int CostRevive = reader.GetInt32(28);
    //int CostBorrow = reader.GetInt32(29);
    //int KeepingFee = reader.GetInt32(30);
    //int SellPrice = reader.GetInt32(31);
    //int ReqLevelType1 = reader.GetInt32(32);
    //int ReqLevel1 = reader.GetInt32(33);
    //int ReqLevelType2 = reader.GetInt32(34);
    //int ReqLevel2 = reader.GetInt32(35);
    //int MaxContain = reader.GetInt32(36);
    //int RegionID = reader.GetInt32(37);
    //int Dir = reader.GetInt32(38);
    //int OffsetX = reader.GetInt32(39);
    //int OffsetY = reader.GetInt32(40);
    //int OffsetZ = reader.GetInt32(41);
    //int Speed1 = reader.GetInt32(42);
    //int Speed2 = reader.GetInt32(43);
    //int Scale = reader.GetInt32(44);
    //int BCHeight = reader.GetInt32(45);
    //int BCRadius = reader.GetInt32(46);
    //int EventID = reader.GetInt32(47);
    //string AssocFileObj128 = reader.GetString(48);
    //string AssocFileDrop128 = reader.GetString(49);
    //string AssocFileIcon128 = reader.GetString(50);
    //string AssocFile1_128 = reader.GetString(51);
    Console.WriteLine("service = {0}, ID = {1}, CodeName128 = {2}, ObjName128 = {3}, OrgObjCodeName128 = {4}", service, ID, CodeName128, ObjName128, OrgObjCodeName128);
    }[/cs]

  • Du kannst dir ne Klasse anlegen, die all die Attribute hat, die du benötigst und dann die ToString Methode überschreiben und dort dann gewünscht formatiert zurückgeben, macht aber nur Sinn wenn du die Ausgabe mehrals einmal benötigst...