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)
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#. :rolleyes:
the vb.net section is in 3rd floor. :D
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