Questions

Any reason to use out parameters with the C# 7 tuple return values?

I have just watched a video presenting the [new features of C# 7](https://www.youtube.com/watch?v=5ju2MuqKf_8). Among others, it introduces the possibility to return a tuple type (e.g.: `(int, int)`, ...

26 Nov at 15:30

How to rewrite URL by middleware in ASP.NET Core MVC

In ASP.NET Core we can use work with the http module to rewrite module like so: How could I rewrite the code above using middleware in ASP.NET Core?

7 May at 02:11

500 - The request timed out

I have a script that runs for about 4mins30seconds and I have changed the default timeout time to 3600 seconds in the config page of my aspx webpage It didn't return the 500 - The request timed out e...

18 Jul at 17:50

ServiceStack - Access to the request DTO when using the built-in auth feature?

I'm implementing a web service using ServiceStack and have hit a snag with authorization. Our auth system provides a "per-organization" list of permissions that a user has, with every request DTO the...

12 Dec at 05:32

What's the difference between System.ValueTuple and System.Tuple?

I decompiled some C# 7 libraries and saw `ValueTuple` generics being used. What are `ValueTuples` and why not `Tuple` instead? - [https://learn.microsoft.com/en-gb/dotnet/api/system.tuple](https://le...

14 Dec at 14:47

How to implement setInterval(js) in C#

JS's setInterval and setTimeOut is really convenient. And I want to ask how to implement the same thing in C#.

10 Dec at 23:11

Visual studio is hanging when add a new dataset to RDLC report

I create a specific `report.rdlc` then i want to add new `datatable` to my report . But after changing the data set ,trying to add new dataset to my report . The visual studio is crashing every time...

Remove all Roles from a user MVC 5

Peace be upon you I am trying to remove all roles from a user to disable his permissions and prevent him from accessing some pages. I found this method to remove one role and it worked: ``` await U...

C#: 'IEnumerable<Student>' does not contain a definition for 'Intersect'

It's been long since I write a single line of code so, please, be patient if I am asking a dumb question. Even though the IntelliSense shows the Intersect method after Names, I get the following erro...

How properly generate bootstrap grid via loop using Razor?

I use ASP.NET MVC and bootstrap. I have many objects (>2) in collection and for each need a `<div class="col-xs-6">` but with only 2 cols in a row. How to achive this using loop? There is 1 way but I ...

How and when does Configuration method in OwinStartup class is called/executed?

Before I ask my question I have already gone through the following posts: 1. Can't get the OWIN Startup class to run in IIS Express after renaming ASP.NET project file and all the posts mentioned in...

23 May at 11:47

Injecting DbContext into service layer

How am I supposed to inject my `MyDbContext` into my database service layer `MyService`? ``` public void ConfigureServices(IServiceCollection services) { services.AddDbContext<MyDbContext>(opti...

ServiceStack return response syntax error

I am just quickly upgrading ServiceStack to version 4.5.4 and I am having a problem trying to convert my service. Basically I cannot longer return the sql response as a string. Does anyone know the co...

IdentityServer "invalid_client" error always returned

I'm trying to use IdentityServer3, but don't know why I'm getting "invalid_client" error always, always no matter what I do. This is the code I'm using: ``` //Startup.cs (Auth c# project) public voi...

Mock IEnumerable<T> using moq

Having this interface, how can I mock this object using moq? ``` public interface IMyCollection : IEnumerable<IMyObject> { int Count { get; } IMyObject this[int index] { get; } } ``` I get:...

27 Jan at 13:29

Cap string to a certain length directly without a function

Not a duplicate of [this](https://stackoverflow.com/q/2776673/3785314). I want to make a string have a max length. It should never pass this length. Lets say a 20 char length. If the provided string ...

23 May at 10:30

ServiceStack.Redis timeout on Azure

I'm moving my ServiceStack API from Linux/Mono (On my own hardware) to the Azure App Service, using SS 4.5.2. My Redis cache is 3.2 running on a Linux VM. I am using the Azure Redis service. I'm se...

How can I upload a file and form data using Flurl?

I'm trying to upload a file with body content. Is `PostMultipartAsync` the only way? On my C# backend code I have this: ``` var resource = FormBind<StorageFileResource>(); var file = Request.Files....

8 Dec at 17:12

Why is the Linq-to-Objects sum of a sequence of nullables itself nullable?

As usual, `int?` means `System.Nullable<int>` (or `System.Nullable`1[System.Int32]`). Suppose you have an in-memory `IEnumerable<int?>` (such as a `List<int?>` for example), let us call it `seq`; the...

Fastest way to map result of SqlDataReader to object

I'm comparing materialize time between Dapper and ADO.NET and Dapper. a few result show that Dapper a little bit faster than ADO.NET(almost all of result show that it comparable though) So I think I...

9 Apr at 12:34

Is there any way to convert .dll file to .cs files

Is there any way to convert .dll file to .cs files? I am searching for any tool or online website what can convert .dll file into .cs files. If any one have any info please inform Thanks in advance. ...

8 Dec at 12:13

Visual Studio C++/CLI Mysterious Error With Template

Well, I've been trying to make a C++ DLL in Visual Studio 2015, which took a while since I'm not very good with Visual Studio. I need to access the .NET libraries, specifically System::Management. (W...

8 Dec at 02:31

Query LOCAL Bitcoin blockchain with C# .NET

I am trying to check the of a given Bitcoin address by using the locally stored blockchain (downloaded via Bitcoin Core). Something similar to this (by using NBitCoin and/or QBitNinja), but without ...

27 Dec at 18:10

ServiceStack - Dynamic/Object in DTO

I am running into an issue while looking at SS. I am writing a custom Stripe implementation and got stuck on web hooks, this in particular: [https://stripe.com/docs/api#event_object](https://stripe.c...

7 Dec at 21:9

Volatile variables

I recently had an interview with a software company who asked me the following question: > Can you describe to me what adding in front of variables does? Can you explain to me why it's important? M...

7 Dec at 21:13