C# Logical Layout

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mcfly1204
    New Member
    • Jul 2007
    • 233

    #1

    C# Logical Layout

    I have an application that reads a directory for XML files, places them in an array, and then performs functions on the files. I want to run my logic past others to see if I am in the right direction.

    -files are selected and put into an array.

    for (int i=0; i<array.length ; i++)
    {
    function 1;
    function 2;
    }

    What I am hoping to happen is to have array[0] run through function 1 and function 2, and then have array[1] run through the functions, running each file in the array separately. Are there any giant flaws in my thinking?
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Your layout seems resonable enough.
    Try it out and see how it works?

    Comment

    • mcfly1204
      New Member
      • Jul 2007
      • 233

      #3
      Originally posted by Plater
      Your layout seems resonable enough.
      Try it out and see how it works?
      Here is my beginner question of the day:

      If want to call one method from another method, what is the proper way to do so?

      protected void btnSubmit_Click (object Sender, Eventargs e)
      {
      sendEmail();
      }

      protected void sendEmail(objec t Sender, Eventargs e)
      {
      //code to send email.
      }

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        Code:
        protected void btnSubmit_Click(object Sender, Eventargs e)
        {
        sendEmail();
        }
        
        protected void sendEmail(object Sender, Eventargs e)
        {
        //code to send email.
        }
        The (object Sender, Eventargs e) part is in there because that function is an event handler and has to fit a certain "template" shall we say.

        If you want to call your function like this:
        Code:
        sendEmail();
        Then you would have:
        Code:
        protected void sendEmail()
        {
        //code to send email.
        }
        I recomend you scoure the web for some beginner concepts and practice tutorials to get you more familiar with you object oriented programming (oop) and syntax

        Comment

        Working...