Results 1 to 3 of 3

Thread: HOw we can pass Optional Parameter and Use of And Operator

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2005
    Location
    Canada
    Posts
    141

    Resolved HOw we can pass Optional Parameter and Use of And Operator

    public int ExecuteQuery(string strQuery,Optional Boolean bPreparedExecute = False, Optional ByVal lRowsEffected As Int32 = -1, optional Boolean bGetRowsEffetted = False)
    ==============================
    else if (myTable.Rows.Count > rowNum And myTable.Rows(rowNum).RowState = DataRowState.Deleted)
    Last edited by Waseemalisyed; May 10th, 2005 at 06:40 AM. Reason: ok

  2. #2
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Re: HOw we can pass Optional Parameter and Use of And Operator

    Quote Originally Posted by Waseemalisyed
    public int ExecuteQuery(string strQuery,Optional Boolean bPreparedExecute = False, Optional ByVal lRowsEffected As Int32 = -1, optional Boolean bGetRowsEffetted = False)
    ==============================
    else if (myTable.Rows.Count > rowNum And myTable.Rows(rowNum).RowState = DataRowState.Deleted)
    i think that was not c#.

    the vb.net section is in 3rd floor.

  3. #3
    Junior Member
    Join Date
    Feb 2005
    Posts
    31

    Re: HOw we can pass Optional Parameter and Use of And Operator

    That definitely wasn't vb.net, but it wasn't c# either. Beats me what it was, actually.

    Code:
    public int ExecuteQuery(string strQuery,Optional Boolean bPreparedExecute = False, Optional ByVal lRowsEffected As Int32 = -1, optional Boolean bGetRowsEffetted = False) 
    
    public int ExecuteQuery(string Query, bool bPreparedExecute, int IRowsEffected, bool bGetRowsEffected)
    {
    }
    There is no such thing as an optional parameter in C#, because optional parameters are essentially just overloads. Instead, make two overloaded functions:

    Instead of

    Code:
    public int FunctionOne(Optional int Parameter, int RegularParameter)
    {
    }
    try this:

    Code:
    public int FunctionOne(int RegularParameter)
    {
    }
    
    public int FunctionOne(int Parameter, int RegularParameter)
    {
    }
    ==============================
    Using and:

    Code:
    public bool Conditions(Point pt1)
    {
        bool retVal = false;
        if ((pt1.X == 1) && (pt1.Y == 0))
        {
        }
        Return retVal;
    }
    And is &&. Or is || (double pipes). Bitwise And is &, bitwise Or is |. Good luck,

    Dan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width