background preloader

What Great .NET Developers Ought To Know (More .NET Interview Questions)

What Great .NET Developers Ought To Know (More .NET Interview Questions)
Related:  .NET / C#

Dot.Blog | MVVM : Gérer les données de Design de façon propre Read this article in your language IT | EN | DE | ES De Silverlight à WinRT en passant les Smartphones, sous Windows ou d’autres OS, les patterns de type MVVM sont devenues indispensables. Toutefois gérer des données de Design pour faciliter la création des UI est souvent mal géré ou oublié. MVVM “Générique” Il existe de nombreux frameworks pour gérer la séparation UI/Code, qu’ils soient basés sur MVVM, MVC ou d’autres patterns. C’est à la fois attirer votre attention sur le principe de fournir des données de design qui m’intéresse ici et la mise en œuvre de moyens simples réutilisables dans une multitude de contextes (quitte à les adapter). Silverlight L’exemple pourrait être fait avec WinRT, WPF, WP7 ou WP8 ou même d’autres technologies, cela n’a pas grande importance. Principes de base des données de design Tout d’abord j’aimerais insister sur la nécessité de proposer des données de design. Les données de design doivent être : Il ne s’agit que des grands principes de base. Lorem Ipsum

Dot.Blog | De la bonne utilisation de Async/Await en C# Read this article in your language IT | EN | DE | ES [new:30:06/2014]Async et Await simplifient l’écriture des applications qui doivent rester fluides et réactives. Mais cela suffit-il à rendre les applications multitâches ? Async et Await Pour ceux qui éventuellement auraient loupé un épisode important des aventures de C#, sa vie, son œuvre en 5 tomes, voici un bref résumé de ce que sont les mots clés Async et Await et ce à quoi ils servent. C’est une question de méthode… De nombreuses méthodes ne retournent pas immédiatement le trait, elles peuvent effectuer des tâches assez longues, comme accéder à des ressources extérieures (Web, réseau, appareil de mesure externe ou interne tel le compas, le GPS, l’accéléromètre…). Toute méthode exécutée sur le thread principal bloque logiquement ce dernier or il est utilisé par l’OS pour gérer l’interface. Les threads ne sont pas des tâches De fait, les threads ne sont pas des tasks… async et await Fixons les choses asynchronisme ! Asynchronisme ! Run(menu);

Share code between WPF and Universal Apps with PRISM This will be a series of blog posts that deals with sharing code and XAML between WPF and Universal Apps. This first part is about the basic project set-up and sharing ViewModels. In following parts we will take a look at sharing XAML (with a preprocessor) and unifying concepts such as navigation. Intro We have so many platforms to code for these days: windows desktop, tablets, phones, the web, even xbox. One of the issues stemming from this abundance is that there are a ton of SDKs that have quite similar APIs, but also some subtle and not-so subtle differences that make cross-platform development a real pain. Having said that, it is worth noting that the new “Universal Apps” are a huge step in the right direction. With Silverlight going away focus is coming back to WPF with great force. Traditional desktop apps are substantially more different than apps for phones/tablets but there is nothing wrong with trying to share code, especially if you are targeting both platforms. The Basics

Top 10 Unity best practices: Naming Conventions : gamedev Multi-Targeting .NET Standard Class Libraries | Gigi Labs The .NET family has grown quite a bit, and to be honest, it’s a bit of a confusing mess. As I already explained in “Migrating Dandago.Finance to .NET Core“, there are now several different types of class library you can choose from (including different kinds of portable class libraries), different ideas of cross-platform (.NET Core vs Universal Windows Platform), different frameworks, and .NET Standard. Let’s consider the following image, which shows three different .NET-based frameworks in relation to .NET Standard: Image credit: .NET Core, .NET Framework, Xamarin – The “WHAT and WHEN to use it” Your applications will typically be built for one of the frameworks on top (e.g. .NET Framework). This means that class libraries that target .NET Standard have maximum compatibility, but there’s a cost: not all APIs are available for .NET Standard, and targeting .NET Standard is only compatible with certain recent versions of those frameworks. For the most part, this is okay.

.NET Framework Development Guide This section explains how to create, configure, debug, secure, and deploy your .NET Framework apps. The section also provides information about technology areas such as dynamic programming, interoperability, extensibility, memory management, and threading. .NET Framework Class Library Supplies syntax, code examples, and usage information for each class that is contained in the .NET Framework namespaces. C# 7.0 and Beyond with Mads Torgersen – Jakub Chodounsky – Medium New Zealand and Wellington especially are not exactly big so when the program manager of C# language comes into town for a meetup it would be a shame to stay at home. This Wednesday the amazing WelliDotNet meetup hosted Mads Torgersen; a guy responsible for the C# language design (and TypeScript and Visual Basic in the past); and he talked about the new features of C# 7.0 and where the next versions are heading. Mads started with the results of Stack Overflow Developer Survey 2017 results where C# is 4th most used programming language. And it also made it to the top 10 most loved programming languages. He thinks the reasons behind that are C# now runs on every platform (not just Windows),Roslyn is an open compiler,you can use your favourite editor, not just Visual Studio andeverything is open source. Q: How hard was it to get more open? C# evolution is a balancing act as you want to New features in C# 7.0 Mads started with minor features and talked briefly about new binary literals. Tuples int?

c# - When to use ref vs out Exemples de requête LINQ Cette documentation est archivée et n’est pas conservée. Date de publication : janvier 2017 S’applique à : Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online L’exemple suivant montre comment récupérer une liste de comptes où Name contient « Contoso ». using (ServiceContext svcContext = new ServiceContext(_serviceProxy)) { var query_where1 = from a in svcContext.AccountSet where a.Name.Contains("Contoso") select a; foreach (var a in query_where1) { System.Console.WriteLine(a.Name + " " + a.Address1_City); } } L’exemple suivant montre comment récupérer une liste de comptes où Name contient « Contoso » et Address1_City a la valeur « Redmond ». using (ServiceContext svcContext = new ServiceContext(_serviceProxy)) { var query_where2 = from a in svcContext.AccountSet where a.Name.Contains("Contoso") where a.Address1_City == "Redmond" select a; foreach (var a in query_where2) { System.Console.WriteLine(a.Name + " " + a.Address1_City); } } Microsoft Dynamics 365

Electron | Build cross platform desktop apps with JavaScript, HTML, and CSS. How generics save from boxing | {coding}Sight At the method input, we often perform a null test. Someone makes the test as a separate method, so that the code looks cleaner, and gets something like this: public void ThrowIfNull(object obj) { if(obj == null) { throw new ArgumentNullException(); } } The interesting thingabout this test is that I see a frequent use of the object attribute, though you can use generic. Let’s try to replace our method with generic and compare performance. Before testing, you need to take into account another drawback of the object argument. Let’s start testing the performance and use the BenchmarkDotNet library. Our generic showed 2000 times faster performance on the nullable type! Thus, the generic argument is better than the object because it: Saves from boxingImproves the method signature by using constraints

Exemples de requête LINQ Cette documentation est archivée et n’est pas conservée. Date de publication : janvier 2017 S’applique à : Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online L’exemple suivant montre comment récupérer une liste de comptes où Name contient « Contoso ». using (ServiceContext svcContext = new ServiceContext(_serviceProxy)) { var query_where1 = from a in svcContext.AccountSet where a.Name.Contains("Contoso") select a; foreach (var a in query_where1) { System.Console.WriteLine(a.Name + " " + a.Address1_City); } } L’exemple suivant montre comment récupérer une liste de comptes où Name contient « Contoso » et Address1_City a la valeur « Redmond ». using (ServiceContext svcContext = new ServiceContext(_serviceProxy)) { var query_where2 = from a in svcContext.AccountSet where a.Name.Contains("Contoso") where a.Address1_City == "Redmond" select a; foreach (var a in query_where2) { System.Console.WriteLine(a.Name + " " + a.Address1_City); } } Microsoft Dynamics 365

ASP.NET Core Configuration - Reloading, Binding, Injecting - Coding Blast Introduction In the last post, we talked about ASP.NET Core Configuration in general. We will see how is it set up by default from ASP.NET Core. We also talked about sources and that order matters. This time we will talk about mapping configuration to classes. We will also talk about various ways of injecting configuration settings to our application code. Another useful thing is automatic reload of configuration. You can find the code with examples here. Binding to models – strongly typed configuration options Let’s say we have following object in our appsettings.json file: And that we want to get those values and map them to an object. We would first create a class that matches that structure (or matches only those keys we want to bind): public class MessagesOptions { public string AlertMessage { get; set; } public string RegularMessage { get; set; } public bool ShouldShowAlert { get; set; } } Now I can bind that object from JSON (section) to an instance of MessageOptions class.

Related: