Is there an equivalent to C#'s #region directive in AS3?
Asked Answered
C

1

5

Just started coding in AS3 with FlashDevelop and coming from a C# background, I would like to know if there's something equivalent to the #region directive in AS3?

The #region directive in C# essentially allows an IDE e.g Visual Studio to collapse or expand a section of code to improve readability. With #region directives, you can split codes in sections e.g constructors, properties, public/private methods to aid others perusing your code.

So the C# code below ...

interface IPurchaseOrder
{
    #region Properties

    bool IsProcessed { get; set; }
    bool ISValidOrder { get; set; }

    #endregion Properties

    #region Methods

    bool ProcessOrder();

    #endregion Methods
}

becomes

interface IPurchaseOrder
{
    Properties

    Methods
}
Caswell answered 11/4, 2010 at 9:20 Comment(3)
Maybe you could explain the #region directive for the non-C# people.Anabas
@Michael Aaron Safyan, thanks for the top, have edited accordingly.Caswell
It's not C#'s directive, it's special mark of Visual Studio. For c# itself it's a regular commentCribb
F
9

With flashdevelop it works like this:

//{ region region name

  ...your code here

//} endregion 
Fructificative answered 11/4, 2010 at 12:44 Comment(2)
I take it that the expand/collapse region functionality is a FlashDevelop-specific feature?Caswell
Yes of course. Code hidding is always IDE/texteditor specific.Fructificative

© 2022 - 2024 — McMap. All rights reserved.