This question is locked. New answers and comments are not allowed.
I've a bit of an issue with this.
Say I have this ...
This option generates code a bit like this...
Meaning my code in MyMethod changes to look like this...
Now, call me old-fashioned, but would the code above look better if it read...
And whilst I'm having a moan, it would be nice to at least have the option of having the created class local (and private) to my current class rather than having it exposed to the wider world (I understand that this might be something I would need for a public method, but not for a private one).
--
Stuart
Say I have this ...
void MyMethod(bool CanDoThis, bool CanDoThat, bool CanDoTheOther)
{
bool x = CanDoThis;
bool y = CanDoThat;
bool z = CanDoTheOther;
}
public
class
MyMethodParameters
{
private
readonly
bool
CanDoThat;
private
readonly
bool
CanDoTheOther;
private
readonly
bool
CanDoThis;
public
MyMethodParameters(
bool
CanDoThis,
bool
CanDoThat,
bool
CanDoTheOther)
{
this
.CanDoThis = CanDoThis;
this
.CanDoThat = CanDoThat;
this
.CanDoTheOther = CanDoTheOther;
}
public
bool
PCanDoThat
{
get
{
return
CanDoThat;
}
}
public
bool
PCanDoTheOther
{
get
{
return
CanDoTheOther;
}
}
public
bool
PCanDoThis
{
get
{
return
CanDoThis;
}
}
}
void
MyMethod(MyMethodParameters myMethodParameters)
{
bool
x = myMethodParameters.PCanDoThis;
bool
y = myMethodParameters.PCanDoThat;
bool
z = myMethodParameters.PCanDoTheOther;
}
Now, call me old-fashioned, but would the code above look better if it read...
void
MyMethod(MyMethodParameters myMethodParameters)
{
bool
x = myMethodParameters.CanDoThis;
bool
y = myMethodParameters.CanDoThat;
bool
z = myMethodParameters.CanDoTheOther;
}
And whilst I'm having a moan, it would be nice to at least have the option of having the created class local (and private) to my current class rather than having it exposed to the wider world (I understand that this might be something I would need for a public method, but not for a private one).
--
Stuart