Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Public parameters get/set

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Public parameters get/set

    I'm looking at code samples to try and figure out what get/set does in the parameters. The 2 examples below. The first example is from the SampleChangeFont script. The other is an edit of that. Removing extra variables and the variables that are passed in the get/set. The result seems to be the same. Could someone please explain the difference and why the sample was done in such a way.


    Code:
    // define vars
    
    private SimpleFont largeFont;
    private SimpleFont smallFont;
    
    //SET DEFAULTS
    largeFont = new Gui.Tools.SimpleFont("Arial", 12);
    smallFont = new Gui.Tools.SimpleFont("Arial", 8);
    
            #region Properties        
            [NinjaScriptProperty]
            [Display(Name="Large Font", Description="Font Size", Order=1, GroupName="Font")]
            public SimpleFont LargeFont
            {
                get{return largeFont;}
                set{largeFont = value;}
            }
            
            [NinjaScriptProperty]
            [Display(Name="Small Font", Description="Font Size", Order=2, GroupName="Font")]
            public SimpleFont SmallFont
            {
                get{return smallFont;}
                set{smallFont = value;}
            }
            #endregion​
    Code:
    //SET DEFAULTS
    
    LargeFont = new SimpleFont("Arial", 18);
    SmallFont = new Gui.Tools.SimpleFont("Arial", 8);
    
            #region Properties        
            [NinjaScriptProperty]
            [Display(Name="Large Font", Description="Font Size", Order=1, GroupName="Font")]
            public SimpleFont LargeFont
            { get; set; }
            
            [NinjaScriptProperty]
            [Display(Name="Small Font", Description="Font Size", Order=2, GroupName="Font")]
            public SimpleFont SmallFont
            { get; set; }
            #endregion​

    #2
    Hello several,

    Below is a link to a 3rd party educational site on properties.
    W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    557 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    545 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X