c# tutorial

Add Watermark Text to Images in ASP.NET MVC – Website Design Article

In this article, we will learn how we can add a watermark to images in ASP.NET MVC 5. We are going to use the .NET graphics library for this. The libraries to be used for this purpose are liseted below: using System.Drawing; using System.Drawing.Imaging; using System.IO; Navigate to View -> Home -> Index.cshtml @{ ViewBag.Title = “Home Page”; } <div> @using (Html.BeginForm(“Index”, “Home”, FormMethod.Post, new { enctype = “multipart/form-data” })) { <div class=”row”> <div class=”form-group col-md-5″> <span>Enter Watermark</span> <input type=”text” class=”form-control”…

Read More

Default Implementations Coming to Interfaces With C# 8 – Website Design Article

C# 8.0 will introduce new language feature — default implementations of interface members. This means that we can define a body-to-interface member and implementing class that doesn’t implement the given interface member and will use the default one from interface itself. Here’s my deep-dive and analysis of default implementions of interfaces. Default Implementations of Interface Members Let’s start with a classic example based on Mads Torgersen’s blog post, Default implementations in interfaces, and take a look at this famous logger example.…

Read More

Tag Helper Syntax for View Components – Website Design Article

Calling view components in ASP.NET Core views may lead to long and ugly code lines containing generic type parameter of view component and anonymous type for InvokeAsync()method parameters. Something my readers have been interested in for a long time is the tag helper syntax for view components. ASP.NET Core Pager Example Suppose you have pager implemented as view component and there’s support for multiple views. public class PagerViewComponent : ViewComponent { public async Task<IViewComponentResult> InvokeAsync(PagedResultBase pagedResult, string viewName = “Default”) {…

Read More