.net methods - mkol/il2js GitHub Wiki

Since our framework doestn't have full functional .NET Virtual Machine (which would be quite hard to do in JavaScript), we cannot handle most of System namespace classes and methods. Here is a list of supported ones.

Mapping.xml

Mapping.xml file contains mapping between System methods its JavaScript handlers. It's described by mapping.xsd schema. It's mappings are applied as default in the compilation process. Mapping.xml contains always most-recent version of mappings.

You can create your own Mapping.xml and place it in directory that contains your .dll file for compilation. It's mappings will be added (and in case of conflicts will take precendence over defaults) to mappings list for the compilation process.

Other supported methods

Unfortunate, not all methods can be mapped to JavaScript using Mapping.xml file. First, there are some issues with reflection to get some methods; secon, some methods must be handled in Framework specific way. Here is a list of such methods:

Parsing methods

  • byte::Parse(string)
  • byte::TryParse(string,out byte)
  • int::Parse(string)
  • int::TryParse(string,out int)
  • double::Parse(string)
  • double::TryParse(string,out Double)

Threads related methods

  • Thread::.ctor(ParametrizedThreadStart)
  • Thread::.ctor(ThreadStart)
  • Thread::Start()
  • Thread::Start(object)
  • Thread::Abort()
  • Thread::Sleep(int)
  • Monitor::Enter(object)
  • Monitor::Exit(object)

Color members

  • Empty
  • each of ColorName properties

Enumerable methods

  • Range(int start, int count)
  • ToDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
  • ToDictionary<TSource, TKey, TElement>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector)
  • IEnumerable<TSource> Distinct<TSource>(this IEnumerable<TSource> source)
  • ToArray<TSource>(this IEnumerable<TSource> source)
  • ToList<TSource>(this IEnumerable<TSource> source)
  • All<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate)
  • Any<TSource>(this IEnumerable<TSource> source)
  • Any<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate)
  • Select<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, int, TResult> selector)
  • Select<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector)
  • OrderBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
  • Where<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate)
  • Where<TSource>(this IEnumerable<TSource> source, Func<TSource, int, bool> predicate)
  • First<TSource>(this IEnumerable<TSource> source)
  • First<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate)
  • Last<TSource>(this IEnumerable<TSource> source) - (for Stack it is top element, not bottom as in .NET)

Limitations

Enumerable methods currently supported ONLY for arrays, lists and other collections, which are based on JavaScript arrays. Full support will be added in future release.

Last method have inconsistent behavior - at client-side it returns top element, not bottom as in .NET.

IEnumerable<> and IEnumerator<>

IEnumerable<> and IEnumerator<> methods related to

  • arrays
  • List<>
  • Dictionary<,>.KeyCollection
  • Dictionary<,>.ValueCollection

are supported.

Methods related to non-generic IEnumerable and IEnumerator are not supported.

Other methods

  • Dictionary<TKey,TValue>::TryGetValue(TKey,out TValue)
⚠️ **GitHub.com Fallback** ⚠️