One of the requested features in TypeScript is support for the kind of compilation constants that C#, for example, provides, where you can say
#if(DEBUG)
MessageBox.Show(...);
#endif| OK, so technically within the class you can still access the variable by calling getMyProperty or setMyProperty instead of via the property, but you still encapsulate the functionality with the getting and setting. |
| // Modifiers on primary constructor params would be nice :-) | |
| struct Point(private readonly double x, private readonly double y) | |
| { | |
| [DestructuringPosition(0)] | |
| public double X { get; } = x; | |
| [DestructuringPosition(1)] | |
| public double Y { get; } = y; | |
| } |
| class Bobbins | |
| { | |
| [CallStackLocal] | |
| public static string Value = "Foo"; | |
| public static void Write() | |
| { | |
| Console.WriteLine(Value); | |
| } | |
| } |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>IE + VS == FAIL</title> | |
| <style type='text/css'> | |
| #drop-area { width: 300px; height: 300px; background-color: #ccc; } | |
| </style> | |
| <script type='text/javascript'> | |
| document.addEventListener("DOMContentLoaded", function() { | |
| var dropArea = document.getElementById("drop-area"); |
| CREATE TABLE [dbo].[Article] | |
| ( | |
| [Id] INT NOT NULL IDENTITY(1,1) PRIMARY KEY, | |
| [Title] NVARCHAR(200) NOT NULL, | |
| [Content] NVARCHAR(MAX) NOT NULL DEFAULT '', | |
| [Created] DATETIME NOT NULL DEFAULT GETDATE() | |
| ) |
| using System; | |
| using System.Web; | |
| namespace MyOtherSite | |
| { | |
| public class CorsModule : IHttpModule | |
| { | |
| public void Init(HttpApplication application) | |
| { | |
| application.BeginRequest += ApplicationOnBeginRequest; |
| namespace Simple.Web.Xml | |
| { | |
| using System.Collections.Generic; | |
| using System.IO; | |
| using System.Threading.Tasks; | |
| using System.Xml.Linq; | |
| using Inflector; | |
| using Helpers; | |
| using Links; | |
| using MediaTypeHandling; |
| public List<Ship> GetShips(ShipFlags flags) | |
| { | |
| var db = Database.Open(); | |
| // Something impossible | |
| var criteria = db.Ship.Id == null; | |
| if (flags.HasValue(ShipFlags.Cargo)) | |
| { | |
| criteria = criteria || db.Ship.Cargo == "Y"; | |
| } | |
| if (flags.HasValue(ShipFlags.Intergalactic)) |
| using System; | |
| using System.Collections.Generic; | |
| using System.Threading.Tasks; | |
| namespace Fix2 | |
| { | |
| using Env = IDictionary<string, object>; | |
| using ComponentFunc = Func<IDictionary<string, object>, Func<Task>, Task>; | |
| using AppFunc = Func<IDictionary<string, object>, Task>; |