Autor Beitrag
M-Cha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 67



BeitragVerfasst: Di 20.10.09 10:14 
Ich habe bei mir 2 Klassen.

Einmal die Klasse Haupt und die Klasse biblo.

In der Klasse Haupt ist das Hauptprogramm drin. In der Klasse biblo sollen die Methoden sein. Eine MEthode habe ich in die biblo ausgelagert. Nur wie bekomm ich sie jetzt in der Haupt ausgeführt?

In meine Projektmappe bei Visual Studio sehe ich die Klasse Haupt und biblo!

KLASSE HAUPT

ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO; 


namespace test
{
    class Haupt
    {
        static void Main(string[] args)
        {
HIER SOLL DIE METHODE DER KLASSE BIBLO ausgegeben werden
        }
    }
}



KLASSE BIBLO


ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace test
{
    class biblo
    {
        // Methode: getGesamtZeilen
        private static int getGesamtZeilen(string Dateiname)
        {
            int counter = 0;
            using (StreamReader countReader = new StreamReader(Dateiname))
            {
                while (countReader.ReadLine() != null)
                {
                    counter++;
                }
            }
            return counter;
        }
    }
}
M-Cha Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 67



BeitragVerfasst: Di 20.10.09 10:36 
FEHLER selber gefunden! Habe die MEthode die Rechte "private" gegeben statt "public"!