Public readonly field v.s. get-only property

Are there cases when you would want a public readonly field v.s. a get-only auto-implemented property? ``` public class Foo { public readonly string Hello; public string Hello2 { get; } } ``...

14 Oct at 09:11

ShimDateTime not available in System.Fakes

I'm learning about using shims in unit tests. I'm trying the classic example with DateTime, from this link: [http://www.wiliam.com.au/wiliam-blog/getting-started-with-microsoft-fakes](http://www.wilia...

14 Oct at 10:54

What's the difference between the following Func<Task<T>> async delegate approaches?

If I have the following method: ``` public async Task<T> DoSomethingAsync<T>(Func<Task<T>> action) { // bunch of async code..then "await action()" } ``` What is the difference between the followin...

23 Aug at 00:52

Specflow steps with await for async API

We're trying to get the following scenrio step to break the test in case failure happens within `DoAyncStuff()` method: ``` [Given(@"There is something")] public async Task GivenSomething() { awa...

16 Oct at 11:55

EPPlus Font Family Not Affected

I'm using asp.net MVC 4 and epplus as a nuget package for exporting my data into an excel file. I do that as the following: ``` var excel = new ExcelPackage(); var workSheet = excel.Workbook.Workshee...

30 Dec at 07:56

What do the different build actions do in a csproj. I.e. AdditionalFiles or Fakes

What do the different build actions do in a Web API project (may apply to other types as well)? I see: None, Compile, Content, Embedded Resource, AdditionalFiles, CodeAnalysisDictionary, ApplicationDe...

Where is the PostAsJsonAsync method in ASP.NET Core?

I was looking for the `PostAsJsonAsync()` extension method in ASP.NET Core. [Based on this article](https://web.archive.org/web/20180914182339/http://dotnetliberty.com/index.php/2015/12/10/typed-exten...

13 Jun at 20:54

Centering an Activityindicator on Xamarin.Forms

I have the XAML above code and I am trying to put an ActivityIndicator on the center of the page after click the Button. I tried using examples of the web, but not succesful. ```xml ...

2 May at 13:2

ServiceStack OAuth mail.ru registration/authorization

I want to make a authorization mail.ru but can't find provider. someone knows how to connect mail.ru or how to configure a different provider? [SS wiki](http://github.com/ServiceStack/ServiceStack/w...

13 Oct at 17:22

Azure key vault: access denied

I have the following code for obtaining a secret from the Azure key vault: ``` public static async Task<string> GetToken(string authority, string resource, string scope) { var authContext...

13 Oct at 15:50

How can I queue a task to Celery from C#?

As I understand message brokers like RabbitMQ facilitates different applications written in different language/platform to communicate with each other. So since celery can use RabbitMQ as message brok...

23 May at 10:30

Why does ToString() on generic types have square brackets?

Why does `new List<string>().ToString();` return the following:? ``` System.Collections.Generic.List`1[System.String] ``` Why wouldn't it just bring back `System.Collections.Generic.List<System.Str...

13 Oct at 11:5

How to use string.Format() to format a hex number surrounded by curly brackets?

`uint hex = 0xdeadbeef;` `string result = "{deadbeef}"` First approach: Explicitly add the `{` and `}`; this works: ``` result = "{" + string.Format("{0:x}", hex) + "}"; // -> "{deadbeef}" ``` ...

20 Oct at 11:12

Add client certificate to .NET Core HttpClient

I was playing around with .NET Core and building an API that utilizes payment APIs. There's a client certificate that needs to be added to the request for two-way SSL authentication. How can I achieve...

Return multiple datasets from sql server stored procedure

I need to return through Web Api a Base64 XML output based upon calling a stored procedures which runs 5 different queries. Stored procedure is not written ( I need to write it ) but there are 5 que...

Get offset minutes from timezone (string) with NodaTime

What's the easiest way to get the minutes if I only have a string that represents the timezone? (for example "Europe/London") So far I have: ``` public static int ConvertFromTimeZoneToMinutesOffset(...

12 Oct at 20:6

WebApiConfig.Register() vs. GlobalConfiguration.Configure()

I have a project with a reference to Web API 2, and I'm working through some issues with routing. As far as I know, the correct way to approach this is to ensure that the following line of code is pre...

7 May at 08:28

Servicestack Multitenancy dynamic plugins

We are moving from an on premise-like application to a multi tenant cloud application. for my web application we made a very simple interface based on IPlugin, to create a plugin architecture. (custo...

12 Oct at 14:47

How do I reference a local image in React?

How can I load image from local directory and include it in `reactjs img src` tag? I have an image called `one.jpeg` inside the same folder as my component and I tried both `<img src="one.jpeg" />` a...

4 Jul at 15:58

Append an empty row in dataframe using pandas

I am trying to append an empty row at the end of dataframe but unable to do so, even trying to understand how pandas work with append function and still not getting it. Here's the code: ``` import p...

12 Oct at 12:17

Is it a good practice to mock Automapper in unit tests?

There is this codebase where we use automapper and have 2 layers, `Domain` and `Service`. Each has its object for data representation, `DomainItem` and `ServiceItem`. The service gets data from domain...

How to use Anaconda Python to execute a .py file?

I just downloaded and installed Anaconda on my Windows computer. However, I am having trouble executing .py files using the command prompt. How can I get my computer to understand that the python.exe ...

12 Oct at 14:46

ASP.NET Core API Controller: Response.Body.WriteAsync base64 string not working

I'm trying to return a base64 string representing a jpeg image from an API Controller and set it as the src of an `` but all my attempts failed. Here is the very simple HTML: And my controller: I've...

Alternative to deprecated getCellType

I'm reading an excel-file (file extension xlsx) using org.apache.poi 3.15. This is my code: ``` try (FileInputStream fileInputStream = new FileInputStream(file); XSSFWorkbook workbook = new XSSFWor...

12 Oct at 09:29

BindableProperty in ContentView not working

I made a very simple Yes/No RadioBox control. In it's code behind I have the following `BindableProperty`: ``` public static readonly BindableProperty SelectedValueProperty = BindableProperty.Create...

12 Oct at 02:23