Promise equivalent in C#

In Scala there is a Promise class that could be used to complete a Future manually. I am looking for an alternative in C#. I am writing a test and I want it to look it similar to this: ``` // var M...

17 Aug at 13:44

How to return a view result without layout from a ServiceStack service?

I have a `ServiceStack`.`Service` implementation that defines a method that must return `HTML` markup, but a fragment only. I tried to just set the `View` property of the an `HttpResult` object withou...

17 Aug at 12:33

How to combine two types of C# lists into one?

I have created two lists say X & Y. These two lists are of different types. (ie `List<class_A> X` & `List<class_B> Y`). Values in both these lists are different. But there is a `DateTime` field in b...

17 Aug at 12:37

Supress/Disable/Solve Visual Studio Build Warning

I am using clickonce for a windows forms application. I have to deploy some resource assemblies. These assemblies are in a folder in my project (not as a reference). They are marked BuildAction = cont...

24 Aug at 16:25

I can seem to get msbuild to build unsafe code blocks

`msbuild` doesn't seem to allow me build `unsafe` blocks even though my `.csproj` specify: ``` <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> ... <AllowUnsafeB...

17 Aug at 09:8

System.out.println() shortcut on Intellij IDEA

I know I can print `System.out.println()` with `"sout" + tab`. Is there a way I can do it with `"Syso" + ctrl + space` like in eclipse?

17 Aug at 09:24

How can I disable some APIs of my ASP.NET application

Let's say that I have a ASP.NET application that have some APIs. For example, ``` {HostName}/api/a/* {HostName}/api/b/* ``` Now I want to disable all `{HostName}/api/a/*` APIs(But remain `/...

17 Aug at 17:14

Passing a list of object in ServiceStack

I have created a customer service using ServiceStack but i am not able to pass a list of object from this method. ``` public class EntityService : Service { /// <summary> /// Re...

17 Aug at 13:17

Why do I get “variable referenced from scope but not defined” error from Ormlite on .net, but it works well on Mono?

I am using ServiceStack Ormlite. My code likes this: ``` var number = _conn.Count<Lot>(lot => lot.Labels.Contains("lookingString")); ``` My problem is the code works well on Mono, but get error fro...

25 Aug at 18:13

Entity Framework Core: Npgsql.PostgresException: 23505: duplicate key value violates unique constraint

I am getting the following exception when I try to insert an user from asp.net web api: `Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while updating the entries. See the inner ex...

17 Aug at 07:44

Build same Project as Console and DLL

I've got an C# Project in Visual Studio, which has `Console Application` as Output Type. But I also need a `Class Library` of this project for another solution. Right now I have to switch the output t...

6 May at 01:0

Why can't I call an extension method as a static method when using static import?

I had a static class, but the static methods weren't extension methods. I decided to refactor the methods into extension methods and didn't expect any code to break since extension methods can be c...

19 Oct at 22:12

git ignore .env files not working

I have a laravel project. In the root directory are these 4 files: > .env .env.example .env.local .env.staging I have a .gitignore file, and I'm listing these 4 files in the .gitignore, one after an...

16 Aug at 19:39

Remove Title Bar from Windows Form (Windows 10 style)

I have a very simple class which inherits from System.Windows.Forms.Form and removes the [WS_CAPTION](https://msdn.microsoft.com/en-us/library/czada357.aspx) window style. It works in Windows XP & 7 p...

16 Aug at 19:17

Entity Framework Core 1.0 Connection Strings

We are working on a vary large ASP.NET Core MVC 1.0 application. We have 4-tiers to each of our applications as follows: 1. DTO 2. Repository (Entity Framework - Code First) 3. Service (Business Log...

Moment get current date

How to get current date using the Moment library? Not timestamp, but date. So please don't refer to that timestamp question already to be found. I know how to get it in regular javascript, but I need...

8 Sep at 10:19

C# EPPlus delete row from excel sheet

I'm currently working with an Excel file that has leading rows that have information I don't need. These extra rows also mess with importing that data in the header row below. So I'm trying to remov...

24 Mar at 22:13

No value accessor for form control with name: 'recipient'

I got this error after upgrading to Angular 2 Rc.5. This is my component template: ``` <md-input [(ngModel)]="recipient" name="recipient" placeholder="Name" class="col-sm-4" (blur...

Count rows within partition in Azure table storage

I've seen various questions around SO about how to get the row count of an Azure storage table, but I want to know how to get the number of rows within a single partition. How can I do this while lo...

ASP.NET Core Web API Authentication

I'm struggling with how to set up authentication in my web service. The service is build with the ASP.NET Core web api. All my clients (WPF applications) should use the same credentials to call the we...

MemoryCacheClient works differently than others - reference retained

I have a service that pulls statistics for a sales region. The service computes the stats for ALL regions and then caches that collection, then returns only the region requested. ``` public object An...

16 Aug at 13:29

Passing body content when calling a Delete Web API method using System.Net.Http

I have a scenario where I need to call my Web API Delete method constructed like the following: ``` // DELETE: api/products/{id}/headers [HttpDelete("{id}/headers")] public void DeleteProductHeaders(...

How to download excel (.xls) file from API in postman?

I am having an API endpoint and Authorization token for that API. The said API is for `.xls` report download, how can I view the downloaded `.xls` file using (if possible) ? If it is not possible us...

Call child component method from parent class - Angular

I have created a child component which has a method I want to invoke. When I invoke this method it only fires the `console.log()` line, it will not set the `test` property?? Below is the quick start A...

Load and save layout of anchorables - Binding of Visibility

I am facing the problem that I cannot open an anchorable of type X after I have loaded my old layout. This happens only when I have closed the anchorable of type X before saving the layout. Does anyo...

18 Aug at 14:27