跨平臺應用開發框架:Bridge.NET
Bridge.NET 通過將 C# 轉換成 JavaScript 來構建跨平臺的移動應用、Web應用和桌面應用。
通過 Visual Studio 插件,它為開發者提供了項目模版和編譯器。
它提供了對很多流行的 JavaScript 框架的支持,如 jQuery,Bootstrap,PhoneGap,AngularJS ……。只需在項目中安裝對應的 NuGet Package,就可以引用相關的 JavaScript API。
C#:
// Full JavaScript API Document.GetElementById("demo") .InnerHTML = "Hello"; // Call Alert() Window.Alert("Bridge.NET"); // C# Classes var person = new Demo.App.Person(); // Set C# Property person.Name = "Frank"; // Generic Lists var people = new List<Person>(); people.Add(person); // Write to the Console Console.WriteLine(people[0].Name); // Frank
JavaScript:
// Converted to correct JavaScript syntax document.getElementById("demo") .innerHTML = "Hello"; // Call alert() window.alert("Bridge.NET"); // JavaScript Classes var person = new Demo.App.Person(); // Converted to proper 'set' and 'get' functions person.setName("Frank"); // Equivalent List in pure JavaScript var people = new Bridge.List(Demo.App.Person)(); people.add(person); // Properly converted to console.log console.log(people.get(0).getName()); // Frank
本文由用戶 cm54 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!