Click here to Skip to main content
15,890,512 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: I suspect there's a Pattern for This: Optional Parameters vs. Overloading Pin
M-Badger16-May-13 9:57
M-Badger16-May-13 9:57 
GeneralRe: I suspect there's a Pattern for This: Optional Parameters vs. Overloading Pin
Eddy Vluggen16-May-13 11:25
professionalEddy Vluggen16-May-13 11:25 
GeneralRe: I suspect there's a Pattern for This: Optional Parameters vs. Overloading Pin
M-Badger16-May-13 9:58
M-Badger16-May-13 9:58 
GeneralRe: I suspect there's a Pattern for This: Optional Parameters vs. Overloading Pin
Eddy Vluggen16-May-13 11:26
professionalEddy Vluggen16-May-13 11:26 
AnswerRe: I suspect there's a Pattern for This: Optional Parameters vs. Overloading Pin
jschell16-May-13 7:57
jschell16-May-13 7:57 
GeneralRe: I suspect there's a Pattern for This: Optional Parameters vs. Overloading Pin
M-Badger16-May-13 8:37
M-Badger16-May-13 8:37 
GeneralRe: I suspect there's a Pattern for This: Optional Parameters vs. Overloading Pin
jschell17-May-13 10:13
jschell17-May-13 10:13 
AnswerRe: I suspect there's a Pattern for This: Optional Parameters vs. Overloading Pin
TnTinMn16-May-13 13:37
TnTinMn16-May-13 13:37 
It looks like you found a solution that you are happy with, but I thought that I would throw my 2 cents worth into the fray.

Based on my understanding of your code, the Luminosity method is the only one that needs a second parameter. Why not remove Luminosity from your methods enum and change:

Public Overloads Sub ToGreyScale(ByVal method As RGBGreyScaleMethod, ByVal factors as LumaEnum)

to:

Public Overloads Sub ToGreyScale(ByVal factors as LumaEnum)

I think that this would given you the intuitiveness factor that you are seeking.

As I don't know what it all is that you are doing in this "Class" the following may not be relevant, but I will throw it out as an alternative. It appears that all you are using it for is to convert a Color structure to its equivalent greyscale color. Perhaps, this may be a case for using extension methods to the Color Structure.
XML
Module GreyScaleExtentions
   Public Enum RBGMethods
       Average
       BlueChannel
       Decompose
       Desaturate
       Lightness
       RedChannel
       GreenChannel
   End Enum

   Public Enum LumaEnum
       BT709
       BT601
       GIMP
   End Enum

   ''' <summary>
   ''' Converts Color to greyscale equivalent using RGBGreyScaleMethod
   ''' </summary>
   ''' <param name="c"></param>
   ''' <param name="RGBMethod"></param>
   ''' <returns></returns>
   ''' <remarks></remarks>
   <Runtime.CompilerServices.Extension()> _
   Public Function ToGreyScale(ByVal c As Color, ByVal RGBMethod As RBGMethods) As Color

   End Function

   ''' <summary>
   ''' Converts Color to greyscale equivalent using luminosity method
   ''' </summary>
   ''' <param name="c"></param>
   ''' <param name="factors"></param>
   ''' <returns></returns>
   ''' <remarks></remarks>
   <Runtime.CompilerServices.Extension()> _
   Public Function ToGreyScale(ByVal c As Color, ByVal factors As LumaEnum) As Color

   End Function
End Module

Then you could use like this:
VB
Sub test()
   Dim c As Color = Color.FromArgb(230, 134, 231, 10)
   Dim gs As Color
   gs = c.ToGreyScale(LumaEnum.BT601)
   gs = c.ToGreyScale(RBGMethods.Average)
End Sub

GeneralRe: I suspect there's a Pattern for This: Optional Parameters vs. Overloading Pin
M-Badger17-May-13 6:49
M-Badger17-May-13 6:49 
GeneralRe: I suspect there's a Pattern for This: Optional Parameters vs. Overloading Pin
TnTinMn17-May-13 8:33
TnTinMn17-May-13 8:33 
GeneralRe: I suspect there's a Pattern for This: Optional Parameters vs. Overloading Pin
M-Badger17-May-13 21:47
M-Badger17-May-13 21:47 
QuestionAssembly Loading Pin
#realJSOP14-May-13 5:10
mve#realJSOP14-May-13 5:10 
AnswerRe: Assembly Loading Pin
Jasmine250114-May-13 6:18
Jasmine250114-May-13 6:18 
GeneralRe: Assembly Loading Pin
#realJSOP14-May-13 6:57
mve#realJSOP14-May-13 6:57 
GeneralRe: Assembly Loading Pin
Jasmine250114-May-13 7:12
Jasmine250114-May-13 7:12 
AnswerRe: Assembly Loading Pin
jschell14-May-13 9:22
jschell14-May-13 9:22 
GeneralRe: Assembly Loading Pin
Jasmine250114-May-13 11:36
Jasmine250114-May-13 11:36 
GeneralRe: Assembly Loading Pin
jschell15-May-13 8:23
jschell15-May-13 8:23 
AnswerRe: Assembly Loading Pin
Abhinav S15-May-13 8:16
Abhinav S15-May-13 8:16 
QuestionThe equivalent of 'OninitDlg()' Pin
Bram van Kampen10-May-13 13:51
Bram van Kampen10-May-13 13:51 
AnswerRe: The equivalent of 'OninitDlg()' Pin
dusty_dex10-May-13 14:18
dusty_dex10-May-13 14:18 
GeneralRe: The equivalent of 'OninitDlg()' Pin
Bram van Kampen12-May-13 13:03
Bram van Kampen12-May-13 13:03 
GeneralRe: The equivalent of 'OninitDlg()' Pin
dusty_dex12-May-13 13:42
dusty_dex12-May-13 13:42 
GeneralRe: The equivalent of 'OninitDlg()' Pin
Bram van Kampen13-May-13 13:06
Bram van Kampen13-May-13 13:06 
AnswerRe: The equivalent of 'OninitDlg()' Pin
Richard MacCutchan12-May-13 21:03
mveRichard MacCutchan12-May-13 21:03 

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.