BluetoothAdapter ActionDiscoveryFinished

I just started to take a look at xamarin and now I want to scan for bluetooth-devices. Therefor I use the following code: ``` BluetoothAdapter bluetoothAdapter = BluetoothAdapter.DefaultAdapter; blue...

23 Aug at 22:36

Entity Framework's Entity Data Wizard Crashes When Connecting to MySQL Database

I am attempting to create an Entity Data Model using the wizard to reverse engineer an existing MySQL database. I get to the Choose Your Data Connection page of the wizard, select an existing MySQL co...

How to handle properly concurency excpetion and expose it via Service Stack?

In my app i expose some functionalities via rest api (using service stack but it is not really important). Currently i'm wondering which is the best way to expose `concurency exception` issue received...

Entity Framework Core does not contain a definition for 'Include'

I am trying to work with Entity Framework Core 1.0 and trying to utilize the .Include when filling objects through the dbcontext. ``` EFTestContext context = new EFTestContext(); var testEnti...

23 May at 12:18

Adding wsdl web reference in asp .Net Core project

I've got web service [http://www.mcommunicator.ru/m2m/m2m_api.asmx?WSDL](http://www.mcommunicator.ru/m2m/m2m_api.asmx?WSDL) And I've got a problem with connecting to it from Visual Studio 2015 in my W...

creating a constant but local array

Sometimes I need a hardcoded lookup table for a single method. I can create such an array either - - ``` public int Convert(int i) { int[] lookup = new[] {1, 2, 4, 8, 16, 32, 666, /*...*/ }...

Suitable constructor for type not found (View Component)

View Component: ``` public class WidgetViewComponent : ViewComponent { private readonly IWidgetService _WidgetService; private WidgetViewComponent(IWidgetService widgetService) { ...

4 Feb at 22:7

The name 'Console' does not exist in the current context In xamarin forms app

I am working on a app in Xamarin Forms that needs to get the geolocation data from the device and then put the geolocation coordinates into the forecast.io URL I am using the Geolocator plugin by Jame...

29 Jun at 03:52

How can i configure JSON format indents in ASP.NET Core Web API

How can i configure ASP.NET Core Web Api controller to return pretty formatted json for `Development` enviroment only? By default it returns something like: ``` {"id":1,"code":"4315"} ``` I would ...

how to work with json object in c#

I'm working with a json which comes from an API, here is what I'm talking about: ``` { "popularity": 3.518962, "production_companies": [ { "name": "value1", "id": 4 }, { ...

25 Aug at 02:23

Can't enter enter text in TextBox control inside Flyout

I want to use the `CommandBar` and a `Flyout` to build something like this. ![search flyout](https://i.stack.imgur.com/j4JUz.png) The user should click the button in the `CommandBar` (`Flyout` open...

23 Aug at 09:11

Asp action route data

In the old version of MVC 5 I could do this to pass route parameters ``` @Html.ActionLink("New item", "Suggestion", new ProductSuggestion() { Username = Model.Username }, new { @class = "btn btn-defa...

how to convert a byte[] to HttpPostedFileBase using c#

How to convert `byte[]` into `HttpPostedFileBase` using C#. I've have tried the following way: But I am getting an cannot implicitly convert error.

5 May at 12:50

C# LINQ Orderby - How does true/false affect orderby?

I was studying a bit of LINQ ordering as I have a list of Ids, and I need to order them sequentially. However, there are certain ids that need to take precedence over the standard ordering. Given thi...

2 Feb at 14:40

Using EPPlus I want to Format all cells as TEXT in a spreadsheet

I want to format all cells of the spreadsheet as text before loading it with the datatable. Here is the sample code I am using ``` StringBuilder sbitems = new StringBuilder(); sbitems.Append(@"selec...

8 Jul at 09:48

How to use .NET WebSocket Client with NTLM proxies?

My goal is to use a WebSocket .Net client implementation (i.e. not a browser) to connect to a WebSocket over a corporate proxy that requires NTLM authentication. So far, all the solutions (e.g. websoc...

23 May at 11:53

How to specify eager loading with DBContext Find method

How do I tell the Find method of a DBContext that it should eagerly load the navigation property/entity? I have the following code which deletes the association to a related Secondary entity: I had ...

6 May at 10:40

ServiceStack CORS - No response to OPTIONS request in IE only

I have enabled global CORS support in my application ``` this.Plugins.Add(new CorsFeature( allowCredentials: true, allowedHeaders: "Content-Type, Authorization", a...

22 Aug at 19:43

Why is it faster to calculate the product of a consecutive array of integers by performing the calculation in pairs?

I was trying to create my own factorial function when I found that the that the calculation is twice as fast if it is calculated in pairs. Like this: Groups of 1: 2*3*4 ... 50000*50001 = 4.1 seconds ...

22 Aug at 20:51

Make dictionary read only in C#

I have a `Dictionary<string, List<string>>` and would like to expose the member as read only. I see that I can return it as a `IReadOnlyDictionary<string, List<string>>`, but I can't figure out how to...

23 Aug at 18:13

How to read connection string in .NET Core?

I want to read just a connection string from a configuration file and for this add a file with the name "appsettings.json" to my project and add this content on it: ``` { "ConnectionStrings": { "De...

ASP.NET Web API Authorization with Postman

I have created an and applied Authorize attribute to the API controller. Now, I want to test it using Postman but I am getting Authorization error. Controller code is: ``` [Authorize] [HttpPost] publ...

25 Aug at 09:56

How to generate JWT Token with IdentityModel Extensions for .NET 5

I am using [IdentityModel Extensions for .NET](https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet) version 4 to generate JWT token with and as below and it works p...

How to print in UWP app?

I am trying to print out something from my UWP app. Basically I've used a WebViewBrush to draw some data on to some `FrameworkElement`'s (Windows.UI.Xaml.Shapes.Rectangle) - and I want to print one of...

22 Aug at 08:31

modify existing where condition in sql expression

Given this Sql Expression as an parameter: (assume there's no way to modify how this input parameter is generated) ``` Db.From<Contact>().Where(C => C.Email != null).Or(C => C.Reference != null); ``...

22 Aug at 09:0