background preloader

.NET / C#

Facebook Twitter

Distributed .NET Core (DShop) - Teaser. A complete containerized .NET Core Application microservice that is as small as possible. Why You Should Use View Components in ASP.NET Core. Learn why you should use View Components — and not Partial Views — in your ASP.NET Core projects with this hands-on example.

Why You Should Use View Components in ASP.NET Core

Why use View Components and not Partial Views? The biggest reason is that when inserting a Partial View into a Razor page, all the ViewData associated with the calling View is automatically associated with the Partial View. ASP.NET MVC 5 Security And Creating User Role in C#, SQL, HTML, XML for Visual Studio 2015. Maartenba/MvcSiteMapProvider: An ASP.NET MVC SiteMapProvider implementation for the ASP.NET MVC framework. TCP / IP Server Client Example Part 1 in C#, VB.NET for Visual Studio 2012. Friends Don’t Let Friends Swallow NullReferenceException. If you are using ASP.NET MVC, Core or non-Core, chances are you are swallowing NullReferenceException without you even noticing.

Friends Don’t Let Friends Swallow NullReferenceException

You can see the screenshot of this repro in my previous post (see: Sixth, fixed null model) But, let’s reproduce this using simple ASP.NET MVC Core program.First, just create a normal MVC application. Then, add the following action: public IActionResult Sample(){ return View();} ASP.NET Core · TypeScript. Install ASP.NET Core and TypeScript First, install ASP.NET Core if you need it.

ASP.NET Core · TypeScript

This quick-start guide requires Visual Studio 2015 or 2017. Next, if your version of Visual Studio does not already have the latest TypeScript, you can install it. Create a new project. Born to Learn. Entity Framework in Depth: The Complete Guide. Getting Started with NUnit in ASP.NET MVC. Posted by: Suprotim Agarwal , on 2/12/2014, in Category ASP.NET MVC Abstract: Set up NUnit in ASP.NET MVC and use the integration points in Visual Studio to integrate NUnit Test Cases Visual Studio 2012 comes with a perfectly capable Unit Testing system in MS Test.

Getting Started with NUnit in ASP.NET MVC

However if your team’s skills require you to use alternate Testing frameworks like NUnit, Visual Studio is game to play along. In this article, we’ll see the how we can setup NUnit to work with Visual Studio’s Test Explorer and run Unit tests in our project. Making ASP.NET MVC code more testable using a Service Layer. – Dhaval. Online. Common wisdom says regarding the Repository and Unit of Work patterns in ASP.NET MVC to implement it on top of Entity Framework.

Making ASP.NET MVC code more testable using a Service Layer. – Dhaval. Online.

This is supposed to make your code more testable and more decoupled, which is always desirable. Doing this, however, can be complicated. The general architecture of an application implementing these patterns (as seen on MSDN) is shown below: Writing smarter cross-platform .NET Core apps with the API Analyzer and Windows Compatibility Pack. Comparing the Properties of Two Objects via Reflection and C# As part of the refactoring I was doing to the load code for crawler projects, I needed a way of verifying that new code was loading data correctly.

Comparing the Properties of Two Objects via Reflection and C#

As it would be extremely time consuming to manually compare the objects, I used Reflection to compare the different objects and their properties. This article briefly describes the process and provides a complete helper function you can use in your own projects. This code is loosely based on a StackOverflow question, but I have heavily modified and expanded the original concept. Obtaining a List of Properties The ability to analyze assemblies and their component pieces is directly built into the .NET Framework, and something I really appreciate - I remember the nightmares of trying to work with COM type libraries in Visual Basic many years ago! The Type class represents a type declaration in your project, such as a class or enumeration. Hide Copy Code. 101 LINQ Samples in C# Tips and Tricks for Visual Studio. You can navigate in Visual Studio 2013 more easily by using the shortcuts in this topic.

Tips and Tricks for Visual Studio

This topic is only a subset of the available keyboard shortcuts. For a more complete list, see Default Keyboard Shortcuts in Visual Studio. For information about how to optimize Visual Studio for accessibility, see Accessibility Tips and Tricks.

DevExpress

.NET Core. C# Essentials. Présentation de la plateforme .Net et du langage C# Depuis la création du tout premier Windows, Microsoft a mis à disposition une API (Application Programming Interface) afin de permettre aux développeurs de concevoir des logiciels exploitant les fonctionnalités fournies par le système d'exploitation.

Présentation de la plateforme .Net et du langage C#

Cette API, ou plutôt ces API, car il y en a eu plusieurs, ont marqué différentes générations et ont énormément évolué au fil des années. De nouvelles API ont fait leur apparition, tandis que d'autres se sont enrichies. Parmi les API les plus marquantes de l'histoire de Windows, nous pouvons citer : NETFX4 Poster. C# Development - Dzone Refcardz. Core .NET - Dzone Refcardz. Cheat Sheets for Developers.

XML

5 Reasons You Should Use the Brand-New C# 7.0 in Your WebDriver Tests - CodeProject. I believe that you need to always play with the latest technologies to be great in what you are doing.

5 Reasons You Should Use the Brand-New C# 7.0 in Your WebDriver Tests - CodeProject

As I promised in my last article Enhanced Selenium WebDriver Tests with the New Improved C# 6.0, now I am going to share with you how you can utilize the power of the brand-new C# 7.0. I am not going to cover all of the features because I don't like some of them or I don't see how we can use them in the tests. You can find even more cool tips and tricks about automated testing in my WebDriver Series.

Quick Navigation Digit Separator. ASP.NET Core Configuration - Reloading, Binding, Injecting - Coding Blast. Introduction In the last post, we talked about ASP.NET Core Configuration in general.

ASP.NET Core Configuration - Reloading, Binding, Injecting - Coding Blast

We will see how is it set up by default from ASP.NET Core. We also talked about sources and that order matters. 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 ». How generics save from boxing. 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: Build cross platform desktop apps with JavaScript, HTML, and CSS. 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 ». C# - When to use ref vs out. 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? .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.

Multi-Targeting .NET Standard Class Libraries. 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). But when you create a class library, you can choose to have it target a specific framework, or .NET Standard. .NET Architecture. Top 10 Unity best practices: Naming Conventions : gamedev.

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. How to implement a bindable progress indicator (loading dots) for MVVM Windows (8.1) Universal apps : csharp. Building a Mobile Cross-Platform App from a Shared C# Code Base with UI for Xamarin. Async/Await - Under the sheets. What Great .NET Developers Ought To Know (More .NET Interview Questions) 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 ? Pas si simple… C’est ce que nous allons voir… 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. Cours. 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é. Cela est aussi essentiel pourtant... 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.