Mike.Sheen wrote:Hi Ryan,
PS: once you create a function to act as a delegate - it's not really anonymous - it's just a delegate function. I notice also you made your delegates shared - which is fine - but you don't have to, even a private function would work.!
Mike, there's still an anonymous delegate in there (well, 10 of them, for setting the P
x prices) - although I moved the logic for creating them to a named method (GetSetPriceDelegate), that method nonetheless returns an anonymous delegate
The 'Shared' methods come from CodeRush, which I use for refactoring. The code in those methods was embedded where they're called from before I got CodeRush to extract the methods. Since that bit of code that I extracted had no references to instance properties, CodeRush has created them as Shared, which improves performance slightly in some scenarios (although probably not noticeably in this one, since this class won't be getting instantiated in volume).
Mike.Sheen wrote:Also, the "If Diagnostics.Debugger.IsAttached Then Diagnostics.Debugger.Break()" lines are probably an oversight left in for debugging - but I'm not judging
Actually, I know it's probably bad, but I mostly leave those in. Since I'm the only one who ever has a debugger attached, nobody ever notices, so I haven't stressed about it.
Of course I also hope that anyone using the code looks at it a bit first, and makes changes suitable for the environment it's going into. For example, the captions and auto-mapping strings for the spare fields should be customised for how they are used in the target environment.
Mike.Sheen wrote:Happy to see others contributing - more to come, I hope!
Happy to share, I hope it encourages others to do the same!
I'd like to share more, although most of the mods I'm making are highly customer-specific. Even with this one, I've only supplied the BusinessLogic part of the whole plugin we've deployed, since the rest of if wasn't relevant to this discussion.