Sort(this) in rotation strategy in Visual Studio
Author: Carova
Creation Date: 6/10/2018 1:57 PM
profile picture

Carova

#1
Sort in Rotation Scripts

CODE:
Please log in to see this code.


I have googled the heck out of "this" attempting to understand what the appropriate translation would be in Visual Studio for "this".

Any help?

Vince
profile picture

Eugene

#2
There's no "translation" for this and no need to modify anything. Prooflink:

Strategies.ActiveTrader - Download Project Source Code (2010.06, final)

See the ATMMar2010 class.

Your question would be OK if it had the compiler error message you're getting. Be careful even when you do a copy/paste. Sounds like a bad copy/paste where you've omitted one of the interface's declaration (and maybe auxiliary Holder class as well):

CODE:
Please log in to see this code.


profile picture

Carova

#3
BINGO!

You nailed it. Bad copy/paste.

Thanks!

Vince
profile picture

superticker

#4
In this case, "this" means "this instance" of the ATMMar2010 class object. The .Sort property takes an IComparer object, which can be different from the default IComparer object you declared for the class as shown in Post #2. This allows you to create, for example, an ascending sort for the default (as shown in Post #2), then override that default with another IComparer object, say a descending sort, as a parameter on .Sort(...).

The lines
CODE:
Please log in to see this code.
mean exactly the same thing. You're telling the .Sort property to use the default IComparer object that your declared for the ATMMar2010 class in Post #2. In this case, that's declared as IComparer<iHolder>
profile picture

Carova

#5
Thanks superticker! I THINK I am starting to get "this". :)

Vince
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).