static property in c# 6

I'm writing a small code to more understand about `property` and `static property`. Like these: ``` class UserIdentity { public static IDictionary<string, DateTime> OnlineUsers { get; set; } ...

3 Jul at 14:37

HttpContext.Current is null when unit test

I have following web Api controller method. When I run this code through web, `HttpContext.Current` is `never null` and give desired value. ``` public override void Post([FromBody]TestDTO model) { ...

3 Jul at 14:26

Cross-platform file name handling in .NET Core

How to handle file name in `System.IO` classes in a cross-platform manner to make it work on Windows and Linux? For example, I write this code that works perfectly on Windows, however it doesn't crea...

1 Mar at 17:1

C# bool is atomic, why is volatile valid

In , we know that a `bool` is atomic - then why is it valid to mark it as `volatile`? what is the difference and what is a good (or even practical) use-case for one versus the other? ``` bool _isPend...

C#: ASP.NET WebApi default route to index.html

I am trying to create an Asp.net WebApi / Single Page Application. I would like my server to dispense index.html if no route is given. I would like it to use a controller when one is specified in the ...

16 May at 18:42

Python regex match space only

In python3, how do I match exactly whitespace character and not newline \n or tab \t? I've seen the `\s+[^\n]` answer from [Regex match space not \n](https://stackoverflow.com/questions/14190038/re...

23 May at 11:58

ASP.NET Core EF Add-Migration command not working

Following this [Microsoft Tutorial](https://docs.efproject.net/en/latest/platforms/aspnetcore/new-db.html#create-your-database) when I run the `PM> Add-Migration MyFirstMigration` command in VS2015 pr...

one of the parameters of a binary operator must be the containing type c#

``` public static int[,] operator *(int[,] arr1, int[,] arr2) { int sum; int[,] res = new int[arr1.GetLength(0), arr2.GetLength(1)]; for (int i = 0; i < arr1.GetLength(0); ...

What is the purpose of casting into "object" type?

I have found code on a website which is as follows. ``` string a = "xx"; string b = "xx"; string c = "x"; string d = String.Intern(c + c); Console.WriteLine((object)a == (object)b); // True Con...

How to set the content-type of request header when using Fetch APi

I am using npm 'isomorphic-fetch' to send requests. The problem I am experiencing is I am unable to set the content-type of the request header. I set a content type of application/json , however the ...

StatusStrip label not visible when text too long

I have a `StatusStrip` docked to the bottom of a C# Form, it contains a label, the text in it displays fine, except when there is longer length of text then it does not display at all, and I have to w...

3 Jan at 16:36

How do I move my ServiceStack API from HTTP to HTTPS selectively

I followed the tutorial [deploy and run Service Stack application on Ubuntu Linux](https://github.com/ServiceStackApps/mono-server-config) and I got my API quickly up and running. So far it's all tho...

1 Jul at 18:43

UWP update UI from Task

I have application, which is checking network ranges (for running http service) in local network. So it means, that I am checking f.e. from 10.0.0.1 to 10.0.0.255. And here is the problem, when runni...

1 Jul at 18:34

Stored procedure with default parameters

I am trying to create a stored procedure based on a query I wrote with parameters that are predefined. When restructuring to a create stored procedure and I execute the stored procedure it states that...

How do I reference a .NET Framework project in a .NET Core project?

I'd really like to start using .NET Core and slowly migrate applications and libraries to it. However, I can't realistically upgrade my entire code base to use .NET Core and then go through the proce...

20 Jun at 09:12

Shell script to open a URL

How do I write a simple shell script (say script.sh), so that I can pass a URL as an argument while executing? I want a browser to start with the page opened on that URL. I want to write the command ...

16 Jul at 21:2

CSS: Workaround to backdrop-filter?

`backdrop-filter` is a recent CSS feature, that is not yet available in modern browsers (at least as of July 1, 2016). - `backdrop-filter`- `-webkit-`- Being in such an unusable state, I would lik...

28 Apr at 16:51

C# OPENXML XLSX Custom Column width

C# newbie here! I need to create a small console application to convert CSV files into XLSX files. I have all my styles and data working, but I want to set a different (from default) width on some c...

1 Jul at 11:37

Covariance and contravariance on Tasks

Given the followin snippet, i quite dont understand what im going to achieve is not possible: Interface: ``` public interface IEntityRepository<out T> : IRepository<IEntity> { void RequeryData...

asp.net core 1.0 web api use camelcase

On `RC2` the same code returns json format with camel case. After netcore 1.0 release i started new project and the same code is returning json in lowercase. [](https://i.stack.imgur.com/vjPkQ.png) ...

bypass invalid SSL certificate in .net core

I am working on a project that needs to connect to an https site. Every time I connect, my code throws exception because the certificate of that site comes from untrusted site. Is there a way to bypa...

10 Aug at 04:19

AddTransient, AddScoped and AddSingleton Services Differences

I want to implement [dependency injection](https://en.wikipedia.org/wiki/Dependency_injection) (DI) in ASP.NET Core. So after adding this code to `ConfigureServices` method, both ways work. What is th...

8 Jun at 00:10

How to use multiple WITH statements in one PostgreSQL query?

I would like to "declare" what are effectively multiple TEMP tables using the WITH statement. The query I am trying to execute is along the lines of: ``` WITH table_1 AS ( SELECT GENERATE_SERIES('20...

Set the IHostingEnvironment in unit test

I am currently upgrading a project from .NET Core RC1 to the new RTM 1.0 version. In RC1, there was a `IApplicationEnvironment` which was replaced with `IHostingEnvironment` in version 1.0 In RC1 I c...

Visual Studio 2015 Update 3 Offline Installer (ISO)

After digging around for Visual Studio IDE 2015 update 3 offline installer, aka ISO file, I found it and I am sharing the url. And, I know this may be posted elsewhere. But I also do know that many p...

15 Mar at 11:29