-
-
Notifications
You must be signed in to change notification settings - Fork 30
Limitations
Alfonso J. Ramos edited this page Mar 22, 2016
·
4 revisions
There are a few things that are beyond the scope of my work:
- I cannot provide Generic Variance.
- I cannot extend reflection (I recommend to use Mono.Cecil)
- I cannot add some methods such as
String.Join(string, IEnumerator<string>)
, I'll provide helper methods instead. Whenever possible this helper methods are going to extension methods to minimize the changes needed in code. For a list see below. - I cannot improve the Garbage Collector. Try using Mono as a back-end.
- I will not include backports of Reactive Extensions or any other code not in the BCL, but I may provide similar functionality.
- I have no intention to backport GUI libraries.
- I cannot modify
EventHandler<T>
to remove the generic constraint that's present in .NET prior .NET 4.5. For workaround see below. - I cannot modify
OperationCanceledException
to add support toCancellationToken
. For workaround see below. - I cannot modify
HashSet<T>
on .NET 3.5 to allow casting toISet<T>
- In the type
IGrouping<TKey, TElement>
TKey
is covariant from .NET 4.0 onward, I cannot make it covariant in .NET 3.5.
These features are not planned to be added or improved:
Environment.SpecialFolder
Environment.Is64BitOperatingSystem
ServiceInstaller.DelayedAutoStart
The following are the notable methods that has been added to existing types:
-
Comparer<T>.Create
was added in .NET 4.5, useComparerExtensions.ToComparer
instead. -
Enum.HasFlag
was added in .NET 4.0, useEnumHelper.HasFlag
instead. -
Stream.CopyTo
was added in .NET 4.0, useStreamExtensions.CopyTo
instead. -
String.IsNullOrWhiteSpace
was added in .NET 4.0, useStringHelper.IsNullOrWhiteSpace
instead. -
String.Concat
andString.Join
has new overloads in .NET 4.0, useStringHelper.Concat
andStringHelper.Join
instead. -
Stopwatch.Restart
was added in .NET 4.0, useStopwatchExtensions.Restart
instead. -
StringBuilder.Clear
was added in .NET 4.0, useStringBuilderExtensions.Clear
instead. - Some methods were added to
Task
in .NET 4.0, useTaskEx
instead.TaskEx
has been made available in all .NET versions and is kept consistent with OmerMor/AsyncBridge and the Async CTP.
Note 1: the class ReadOnlyCollection
exists since .NET 2.0, it takes a IList<T>
instead of ICollection<T>
and does not implement IReadOnlyCollection<T>
which was added in .NET 4.5 - the class ExtendedReadOnlyColletion<T>
aliviates these problems.
Note 2: I have tryied porting to Portable Class Library... the limited reflection left no clear path to port Linq.Expressions
and the changes in the threading model would require a rewrite of most of the threading related code.
Others:
- The classes added in .NET 4.5 that require
EventHandler<T>
without the generic constraint may get backported usingTheraot.Core.NewEventHandler<T>
. Avoid usingEventHandler<T>
explicitly in those cases. - The classes added in .NET 4.0 or .NET 4.5 that require
OperationCanceledException.CancellationToken
et al. may get backported usingTheraot.Core.NewOperationCanceledException
. Avoid creating this exceptions yourself.