Click here to Skip to main content
15,921,467 members
Home / Discussions / C#
   

C#

 
AnswerRe: Enum Question Pin
DaveyM6918-Dec-12 9:37
professionalDaveyM6918-Dec-12 9:37 
According to MSDN[^]:
A procedure cannot detect at run time whether a given argument has been omitted or the calling code has explicitly supplied the default value


You have a few choices. You can overload the method and have a private one with a bool flag:
C#
public void Method()
{
    Method(true, 0);
}
public void Method(YourEnum yourEnum)
{
    Method(false, yourEnum);
}
private void Method(bool ignoreEnum, YourEnum yourEnum)
{
    if(ignoreEnum)
    {
    }
    else
    {
    }
}

You can use nullable as suggested in an answer above.

You can add a value to the enum Invalid = -1 and use that as the default parameter value.
Dave

Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.
Astonish us. Be exceptional. (Pete O'Hanlon)

BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)



GeneralRe: Enum Question Pin
PIEBALDconsult18-Dec-12 10:43
mvePIEBALDconsult18-Dec-12 10:43 
QuestionVsIntegrationPackage: Debugging does not reload .vsct file Pin
Member 802402518-Dec-12 4:16
Member 802402518-Dec-12 4:16 
QuestionHow to shwo the values in radiobuttons and labels which are reside inside a single column of gridview Pin
Arun kumar Gautam18-Dec-12 1:47
Arun kumar Gautam18-Dec-12 1:47 
AnswerRe: How to shwo the values in radiobuttons and labels which are reside inside a single column of gridview Pin
Richard MacCutchan18-Dec-12 7:11
mveRichard MacCutchan18-Dec-12 7:11 
QuestionReflection question (for <= .NET 3.5) Pin
MarkB77718-Dec-12 0:24
MarkB77718-Dec-12 0:24 
AnswerRe: Reflection question (for <= .NET 3.5) Pin
Richard Deeming18-Dec-12 1:39
mveRichard Deeming18-Dec-12 1:39 
GeneralRe: Reflection question (for <= .NET 3.5) Pin
MarkB77718-Dec-12 8:50
MarkB77718-Dec-12 8:50 
AnswerRe: Reflection question (for <= .NET 3.5) Pin
PIEBALDconsult18-Dec-12 5:17
mvePIEBALDconsult18-Dec-12 5:17 
GeneralRe: Reflection question (for <= .NET 3.5) Pin
MarkB77718-Dec-12 8:53
MarkB77718-Dec-12 8:53 
Questioncrystalreport Pin
mehdi jan17-Dec-12 19:26
mehdi jan17-Dec-12 19:26 
AnswerRe: crystalreport Pin
Mycroft Holmes17-Dec-12 21:22
professionalMycroft Holmes17-Dec-12 21:22 
QuestionFTP Pin
dineshvalluru1116-Dec-12 20:39
dineshvalluru1116-Dec-12 20:39 
AnswerRe: FTP Pin
Sivaraman Dhamodharan16-Dec-12 20:44
Sivaraman Dhamodharan16-Dec-12 20:44 
GeneralRe: FTP Pin
dineshvalluru1116-Dec-12 21:36
dineshvalluru1116-Dec-12 21:36 
GeneralRe: FTP Pin
Richard MacCutchan16-Dec-12 22:08
mveRichard MacCutchan16-Dec-12 22:08 
GeneralRe: FTP Pin
Paul Conrad17-Dec-12 5:59
professionalPaul Conrad17-Dec-12 5:59 
GeneralRe: FTP Pin
Richard MacCutchan17-Dec-12 6:00
mveRichard MacCutchan17-Dec-12 6:00 
GeneralRe: FTP Pin
Marco Bertschi18-Dec-12 1:34
protectorMarco Bertschi18-Dec-12 1:34 
QuestionDataGridView Control Pin
C#_Programmer16-Dec-12 19:51
C#_Programmer16-Dec-12 19:51 
AnswerRe: DataGridView Control Pin
Ingo16-Dec-12 23:36
Ingo16-Dec-12 23:36 
GeneralRe: DataGridView Control Pin
C#_Programmer17-Dec-12 1:26
C#_Programmer17-Dec-12 1:26 
GeneralRe: DataGridView Control Pin
Dave Kreskowiak17-Dec-12 3:13
mveDave Kreskowiak17-Dec-12 3:13 
AnswerRe: DataGridView Control Pin
PIEBALDconsult17-Dec-12 3:32
mvePIEBALDconsult17-Dec-12 3:32 
Questionenum question Pin
Blubbo16-Dec-12 16:13
Blubbo16-Dec-12 16:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.