Cannot see the Image type in System.Drawing namespace in .NET
I'm trying to write a program that sorts images in specific folder by ther dimensions and moves little images to another folder via simple .NET console application. I decided to use System.Drawing.Ima...
- Modified
- 6 May at 22:34
C# Double.ToString() performance issue
I have the following method to convert a double array to a `List<string>`: ``` static Dest Test(Source s) { Dest d = new Dest(); if (s.A24 != null) { double[]...
Xamarin - Show image from base64 string
I'm pretty new to Xamarin and XAML stuff and here is what I've done so far in my portable project used by Android & iPhone (only using Android): Item.cs (loaded from JSON) ``` [JsonProperty("image")...
- Modified
- 6 May at 19:43
Is there a way change the Controller's name in the swagger-ui page?
I'm using Swashbuckle to enable the use of swagger and swagger-ui in my WebApi project. In the following image you can see two of my controllers shown in the swagger-ui page. These are named as they ...
- Modified
- 18 Apr at 18:6
How to use mapper.Map inside MapperConfiguration of AutoMapper?
I need to map an object to another one using AutoMapper. The tricky question is how can I access an instance of the mapper (instance of IMapper) inside of the mapping configuration or inside of a cust...
- Modified
- 27 Dec at 22:44
Wrong line numbers in stack trace
## The problem On our ASP .net website I keep getting wrong line numbers in stack traces of exceptions. I am talking about our live environment. There seems to be a pattern: The stack trace will a...
XML Serialization similar to what Json.Net can do
I have the following Console application: ``` using System; using System.IO; using System.Xml.Serialization; using Newtonsoft.Json; namespace OutputApp { public class Foo { public o...
- Modified
- 23 May at 12:23
Split a list into multiple lists at increasing sequence broken
I've a List of int and I want to create multiple List after splitting the original list when a lower or same number is found. ``` List<int> data = new List<int> { 1, 2, 1, 2, 3, 3, 1, 2, 3, 4, 1, 2,...
Adding key values for items in picker
I am using a XAMARIN picker to select a country. The countries are hard coded in the picker. Is there a way I could identify each country name through a key value. I have done this in a similar way us...
- Modified
- 6 May at 10:54
c#: How to Post async request and get stream with httpclient?
I need to send async request to the server and get the information from the response stream. I'm using HttpClient.GetStreamAsync(), but the server response that POST should be used. Is there a simila...
- Modified
- 6 May at 08:7
Could not load file or assembly 'RestSharp, Version=105.2.3.0
I am having some trouble understanding this issue. I have a local project with [Twilio added via Nuget](https://www.twilio.com/docs/csharp/install). But when I export the project to my IIS server, i...
Azure AD exception - AADSTS50105 - "The signed in user is not assigned to a role for the application"
I'm setting up authentication with Azure AD for an ASP.NET Web API 2 REST API. I'd like all clients to be able to use a username & password to authenticate with the REST API. I've setup Azure AD (fu...
- Modified
- 6 May at 02:7
iOS background thread slow down when UI is idle
I have a Xamarin app that streams video from a remote server. I have a background thread that loops like this (pseudo-code): ``` private void UpdateMethod() { while (running) { boo...
- Modified
- 5 May at 22:3
Bad performance on Azure for Owin/IIS application
We measured some performnace tests and I noticed that the CPU is running a lot of time in kernel mode. I'd like to know why is that. : it's classic Azure Cloud service web role where Owin is listenin...
- Modified
- 16 May at 05:40
How to change cell color with NPOI
``` using NPOI.XSSF.UserModel; using NPOI.XSSF.Model; using NPOI.HSSF.UserModel; using NPOI.HSSF.Model; using NPOI.SS.UserModel; using NPOI.SS.Util; (...) XSSFWorkbook hssfwb; using (FileStream ...
Why use It.is<> or It.IsAny<> if I could just define a variable?
Hi I've been using moq for a while when I see this code. I have to setup a return in one of my repo. ``` mockIRole.Setup(r => r.GetSomething(It.IsAny<Guid>(), It.IsAny<Guid>(), It...
- Modified
- 26 Sep at 23:54
UserPrincipal.FindByIdentity() always returns null
I am using LdapAuthentication to log a user into Active Directory. I want to find all the groups that the user belongs to. I am using the following code: string adPath = "LDAP://OU=HR Controlled Use...
- Modified
- 16 May at 18:43
Mock.Of<Object> VS Mock<Object>()
I'm currently confuse on how to mock. I'm using Moq. To mock objects I usually write this way ``` var mockIRepo = new Mock<IRepo>(); ``` However, I need to create mock object for my setup. Is it...
- Modified
- 5 May at 04:53
async/await and opening a FileStream?
I came across the following question when trying to determine if I was using the `Stream` methods such as `ReadAsync` and `CopyToAsync` correctly: [C# 4.5 file read performance sync vs async](https://...
- Modified
- 23 May at 12:8
Null conditional operator to "nullify" array element existence
The new C# 6.0 null-conditional operator is a handy vehicle for writing more concise and less convoluted code. Assuming one has an array of customers, then you could get null instead of a length if `c...
- Modified
- 5 May at 00:33
C# Download all files and subdirectories through FTP
I'm still in the process of learning C#. To help myself out, I'm trying to create a program that will automatically synchronise all of my local projects with a folder on my FTP server. This so that w...
- Modified
- 4 Nov at 20:37
Mock IAuthSession.GetOAuthTokens
I have a Service Stack Service that uses the following code ``` public MyResponse Get(MyRequest request){ var authSession = GetSession(); var tokens = authSession.GetOAuthTokens("somekey"); ...
- Modified
- 4 May at 19:50
How to remove ContentType requirement from NServiceKit request
I am trying to make a RESTful web service using NServiceKit version 1.0.43. I want this to work without an outside service that is not including a ContentType in their header request. My web service i...
- Modified
- 4 May at 18:54
Web API Controller convert MemoryStream into StreamContent
I have a large collection of images stored on a secured server some of which need to be displayed on a world facing portal. The portal's server is inside a DMZ which allows requests in but prevents di...
- Modified
- 24 Jun at 01:46