Click here to Skip to main content
15,900,589 members
Home / Discussions / C#
   

C#

 
AnswerRe: Centralized database for c# Windows Application (WinForms) Pin
jschell24-Apr-24 12:39
jschell24-Apr-24 12:39 
GeneralRe: Centralized database for c# Windows Application (WinForms) Pin
theo tuombe25-Apr-24 1:00
theo tuombe25-Apr-24 1:00 
GeneralRe: Centralized database for c# Windows Application (WinForms) Pin
Dave Kreskowiak25-Apr-24 3:16
mveDave Kreskowiak25-Apr-24 3:16 
GeneralRe: Centralized database for c# Windows Application (WinForms) Pin
theo tuombe25-Apr-24 3:52
theo tuombe25-Apr-24 3:52 
GeneralRe: Centralized database for c# Windows Application (WinForms) Pin
Dave Kreskowiak25-Apr-24 4:04
mveDave Kreskowiak25-Apr-24 4:04 
GeneralRe: Centralized database for c# Windows Application (WinForms) Pin
theo tuombe25-Apr-24 4:40
theo tuombe25-Apr-24 4:40 
GeneralRe: Centralized database for c# Windows Application (WinForms) Pin
theo tuombe25-Apr-24 4:40
theo tuombe25-Apr-24 4:40 
GeneralRe: Centralized database for c# Windows Application (WinForms) Pin
Dave Kreskowiak25-Apr-24 5:36
mveDave Kreskowiak25-Apr-24 5:36 
GeneralRe: Centralized database for c# Windows Application (WinForms) Pin
jschell26-Apr-24 12:59
jschell26-Apr-24 12:59 
AnswerRe: Centralized database for c# Windows Application (WinForms) Pin
PIEBALDconsult25-Apr-24 4:55
mvePIEBALDconsult25-Apr-24 4:55 
AnswerRe: Centralized database for c# Windows Application (WinForms) Pin
Ravi Bhavnani27-Apr-24 10:01
professionalRavi Bhavnani27-Apr-24 10:01 
GeneralRe: Centralized database for c# Windows Application (WinForms) Pin
theo tuombe27-Apr-24 11:16
theo tuombe27-Apr-24 11:16 
QuestionSelf referencing loop detected for property with type ... Pin
AtaChris22-Apr-24 9:02
AtaChris22-Apr-24 9:02 
AnswerRe: Self referencing loop detected for property with type ... Pin
Richard Andrew x6422-Apr-24 12:37
professionalRichard Andrew x6422-Apr-24 12:37 
AnswerRe: Self referencing loop detected for property with type ... Pin
AtaChris22-Apr-24 21:30
AtaChris22-Apr-24 21:30 
AnswerRe: Self referencing loop detected for property with type ... Pin
Dave Kreskowiak22-Apr-24 13:43
mveDave Kreskowiak22-Apr-24 13:43 
GeneralRe: Self referencing loop detected for property with type ... Pin
AtaChris22-Apr-24 21:28
AtaChris22-Apr-24 21:28 
GeneralRe: Self referencing loop detected for property with type ... Pin
Dave Kreskowiak23-Apr-24 4:48
mveDave Kreskowiak23-Apr-24 4:48 
That's not how you do dependency injection.

Your Indicator class is useless as it has no way of setting its TradingManager property. Also, the JsonIgnoreAttribute is only useful if you're serializing the Indicator class to a file. I'm leaving the Indicator out of your code.
C#
class MyTradingManager : ITradingManager
{
   ... Code to implement the ITradingManager interface ...
}

C#
internal class SampleIndicator : ExtendedIndicator
{
      private ITradingManager _tradingManager;

      public SampleIndicator(ITradingManager tradingManager)
      {
           _tradingManager = tradingManager;
      }

      ... Code that uses the ITradingManager implementation ...
}

Note, for this to work, you cannot make SampleIndicator dependent on MyTradingManager. It should take an instance of some implementation of ITradingManager instead. MyTradingManager is that implementation. Whatever code is creating instances of this stuff has to create an instance of MyTradingManager and pass that to the constructor of SampleIndicator:
C#
{
    ...
    ITradingManager manager = new MyTradingManager();           // Create the dependency
    SampleIndicator indicator = new SampleIndicator(manager);   // Inject the dependency into SampleIndicator
    ...
}


QuestionHow to print the property values of an object to a file/console ? Pin
AtaChris22-Apr-24 8:51
AtaChris22-Apr-24 8:51 
AnswerRe: How to print the property values of an object to a file/console ? Pin
Dave Kreskowiak22-Apr-24 13:49
mveDave Kreskowiak22-Apr-24 13:49 
GeneralRe: How to print the property values of an object to a file/console ? Pin
AtaChris22-Apr-24 21:23
AtaChris22-Apr-24 21:23 
GeneralRe: How to print the property values of an object to a file/console ? Pin
Pete O'Hanlon22-Apr-24 22:44
mvePete O'Hanlon22-Apr-24 22:44 
GeneralRe: How to print the property values of an object to a file/console ? Pin
Dave Kreskowiak23-Apr-24 4:10
mveDave Kreskowiak23-Apr-24 4:10 
QuestionHow to identify Key Combinations ? Pin
AtaChris15-Apr-24 6:26
AtaChris15-Apr-24 6:26 
AnswerRe: How to identify Key Combinations ? Pin
Dave Kreskowiak15-Apr-24 6:35
mveDave Kreskowiak15-Apr-24 6:35 

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.