https://github.com/dotnet/corefx/issues/973
It probably answers a few of the questions several have asked in this thread with regards to what the .NET Core is.
71–80 of 107 posts
https://github.com/dotnet/corefx/issues/973
It probably answers a few of the questions several have asked in this thread with regards to what the .NET Core is.
Recently I got to use some C# on Linux (with Mono framework), and I gotta say it wasn't bad. I didn't do anything with GUI elements, was all back-end server code. C# wouldn't be my top "go to" language, but I would put it above Java. I liked some of the generics handling better, it can be less verbose it seems. Monodevelop is not on par with Visual Studio, but it is solid and worked well for me. I usually don't like…
> I liked some of the generics handling better, it can be less verbose it seems. It pays off in spades in a lot of situations, but the biggest I've noticed is Android development. Hitting a network from a button press in Xamarin is as simple as: button.OnClick += async { var data = HitTheNetworkForSomeData(); // Note that since this is still async, // you may want to set a global or have a // different approach to ha…
Earlier quoted context omitted.
> I liked some of the generics handling better, it can be less verbose it seems. It pays off in spades in a lot of situations, but the biggest I've noticed is Android development. Hitting a network from a button press in Xamarin is as simple as: button.OnClick += async { var data = HitTheNetworkForSomeData(); // Note that since this is still async, // you may want to set a global or have a // different approach to ha…
This. The amount of new Thread(new Runnable(){...}).start() I have in my Android code is awful. And then inside the Thread you have to use runOnUiThread() to change UI stuff. Given how common it is for an app to hit the network, this should be much much easier. Looking at your example it might be slightly easier but it also isn't inlineable. C# solves both of these problems
public SearchViewModel(ISearchService searchService = null) : ReactiveObject, IRoutableViewHost
{
SearchService = searchService ?? Locator.Current.GetService();
// Here we're describing here, in a *declarative way*, the conditions in
// which the Search command is enabled. Now our Command IsEnabled is
// perfectly efficient, because we're only updating the UI in the scenario
// when it should change.
var canSearch = this.WhenAny(x => x.SearchQuery, x => !String.IsNullOrWhiteSpace(x.Value));
// ReactiveCommand has built-in support for background operations and
// guarantees that this block will only run exactly once at a time, and
// that the CanExecute will auto-disable and that property IsExecuting will
// be set according whilst it is running.
Search = ReactiveCommand.CreateAsyncTask(canSearch, async _ => {
return await searchService.Search(this.SearchQuery);
});
// ReactiveCommands are themselves IObservables, whose value are the results
// from the async method, guaranteed to arrive on the UI thread. We're going
// to take the list of search results that the background operation loaded,
// and them into our SearchResults.
Search.Subscribe(results => {
SearchResults.Clear();
SearchResults.AddRange(results);
});
// ThrownExceptions is any exception thrown from the CreateAsyncTask piped
// to this Observable. Subscribing to this allows you to handle errors on
// the UI thread.
Search.ThrownExceptions
.Subscribe(ex => {
UserError.Throw("Potential Network Connectivity Error", ex);
});
// Whenever the Search query changes, we're going to wait for one second
// of "dead airtime", then automatically invoke the subscribe command.
this.WhenAnyValue(x => x.SearchQuery)
.Throttle(TimeSpan.FromSeconds(1), RxApp.MainThreadScheduler)
.InvokeCommand(this, x => x.Search);
}Recently I got to use some C# on Linux (with Mono framework), and I gotta say it wasn't bad. I didn't do anything with GUI elements, was all back-end server code. C# wouldn't be my top "go to" language, but I would put it above Java. I liked some of the generics handling better, it can be less verbose it seems. Monodevelop is not on par with Visual Studio, but it is solid and worked well for me. I usually don't like…
> I liked some of the generics handling better, it can be less verbose it seems. It pays off in spades in a lot of situations, but the biggest I've noticed is Android development. Hitting a network from a button press in Xamarin is as simple as: button.OnClick += async { var data = HitTheNetworkForSomeData(); // Note that since this is still async, // you may want to set a global or have a // different approach to ha…
Then check out http://arteksoftware.com/resilient-network-services-with-xam... for the pattern/inspiration how to glue them together to obtain a x-platform resilient, performant and data caching network stack. Write once, enjoy on every platform.
Earlier quoted context omitted.
Task /async is a slightly different beast, effectively its a goroutine+channel which can only return 1 value or throw an exception. A better alternative to channels is Rx (Reactive Extensions) which gives you IObservable . It's very simple and powerful. Observables can be composed using Linq, and they're monadic (if that matters). I like the first class notion that something can fail or be completed (go has close(),…
What is the bind semantic in rx?
For example of a RX backend API check out https://github.com/AdaptiveConsulting/ReactiveTrader
Recently I got to use some C# on Linux (with Mono framework), and I gotta say it wasn't bad. I didn't do anything with GUI elements, was all back-end server code. C# wouldn't be my top "go to" language, but I would put it above Java. I liked some of the generics handling better, it can be less verbose it seems. Monodevelop is not on par with Visual Studio, but it is solid and worked well for me. I usually don't like…
I am python developer, I am looking forward to program in F#. F# just seems right after developing with python unlike languages like c#, java.
I thought Microsoft was phasing out .NET and encouraging people to write their GUIs in JavaScript. That's what they were saying early last year.
Unfortunately there are a few libraries I use at work that were released around the whole Windows RT/JS debacle, so their documentation takes a little more figuring, and is frequently incorrect, due to only having code samples in these dead/orphaned variants.
Earlier quoted context omitted.
In this particular case, yes. Another issue that comes up is when you've got fairly type-heavy code. C# having real generics just makes things much simpler than in Java.
Yes c# generics are often a lot less painful, due to lack of type erasure, and support for variable number of type parameters etc. Having said that, more is possible with Java than many people realise. You can read statically available generic type params at runtime (field declarations, supertype tokens etc) . There are also workarounds for most of the erasure problems like methods that vary by generic type parameter…
Earlier quoted context omitted.
Yes c# generics are often a lot less painful, due to lack of type erasure, and support for variable number of type parameters etc. Having said that, more is possible with Java than many people realise. You can read statically available generic type params at runtime (field declarations, supertype tokens etc) . There are also workarounds for most of the erasure problems like methods that vary by generic type parameter…
C# also infers method type parameters, and will implicitly convert a lambda to a matching interface. Fluent code in C# is also very clean. They're great features in both languages.
class Example
{
public static void Main()
{
Predicate foo = Foo(s => s.Contains("foo"));
}
static Predicate Foo(Predicate p)
{
return p;
}
}
I can't replace Foo with just Foo on the right hand side on the 3rd line. I could, however, replace the left hand side with just "var". (n.b. I am using mono, with langver=5. It's possible this is improved in a newer version)Java will infer the RHS
class Example {
public static void main(String... args) {
Predicate foo = foo(s -> s.contains("foo"));
}
static Predicate foo(Predicate p) {
return p;
}
}
The structural typing of lambdas in c# I believe works with delegates? I at least don't know how I'd do the following in c# (I suspect I'd have to define an override of the implicit type conversion operator from a delegate type to a class, or define an extension method called hello on a suitable type) public class Example {
interface MyPredicate {
boolean test(T t);
default void hello() {
System.out.println("Hello");
}
}
public static void main(String... args) {
MyPredicate foo = s -> s.contains("foo");
foo.hello();
}
}
The structural typing here is really powerful, e.g. for working around things like type erasure ;) http://benjiweber.co.uk/blog/2015/02/20/work-around-java-sam... or more consise builder pattern http://benjiweber.co.uk/blog/2014/11/02/builder-pattern-with...Earlier quoted context omitted.
It's spelled filter http://en.wikipedia.org/wiki/Filter_%28higher-order_function...
The LINQ API is modeled after relational algebra (where `Select` acts as projection, and `Where` acts as selection, etc.), which is as good a basis for operations on collections as anything. It is not even clear that other popular names have precedent, let alone especially useful expressive power beyond what normal relational algebras afford. Besides that, one of the early intents behind LINQ was to allow a language-…