Ignoring exceptions when using c# selenium webdriverWait wait.untill() function

In order to check if an Element is exists and clickble i'm trying to write a boolean method which will wait for the element to be enabled and displyed using C# selenium's webDriverWait as follow: In c...

How to invoke async methods in Hangfire?

I have asp.net core API application and this is the first time i will be using HangFire. In .Net Core application all my methods are async. Based on [SO Post](https://stackoverflow.com/questions/3265...

17 Jul at 15:54

Three gray dots under variable names in Visual Studio

![Two variable names with three gray dots under each of them](https://i.stack.imgur.com/xiexo.png) What do these three gray dots mean? I recently updated to Visual Studio 2017, and I haven't ever see...

29 Mar at 17:20

Path.GetRandomFileName vs Path.GetTempFileName

Base on recommendation from https://msdn.microsoft.com/en-us/library/system.io.path.getrandomfilename(v=vs.110).aspx I have replaced GetTempFileName with GetRandomFileName to get a name for the temp f...

7 May at 03:57

How to truncate or pad a string to a fixed length in c#

Is there a one-liner way of setting a `string` to a (in C#), either by it or it with spaces (`' '`). For example: ``` string s1 = "abcdef"; string s2 = "abc"; ``` after setting both to length `...

26 Oct at 19:39

how to refresh token servicestack typescript

On servicestack it says that for regular client it should be like that but for typescript it should be somehow different. Anyone knows how to do it? ``` var client = new JsonServiceClient(baseUrl); c...

30 Mar at 07:37

Setting index.html as default page in asp.net core

How can I get asp.net core to serve an index.html file from inside my wwwroot? The reason I want to do this is because I an developing an angular 4 app using the angular CLI and it takes care of the ...

29 Mar at 10:42

When does a C# Task actually start?

When does a Task actually start? ``` public void DoSomething() { Task myTask = DoSomethingAsync(); Task.WaitAll(new[] { myTask }, 2000); } public async Task DoSomethingAsync() { await S...

29 Mar at 09:19

Entity Framework Core jsonb column type

I am using Entity Framework Core with npgsql postgresql for Entity Framework Core. My question is, using migrations, how do I mark a class property to generate a JSONB column type? For example: ```...

How to add a generic dependency injection

Working on a read-only api service and making use of generics to package the operation into convention based process. Repository interface: ``` public interface IRepository<TIdType,TEntityType> wher...

Prevent IDM from downloading automatically in web api

I have a web api method that returns an `HttpResponseMessage` containing a PDF file. The method looks something like this: ``` HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK)...

17 May at 10:8

Use body stream parameter in WebApi controller's action

I currently read input stream from body like this: ``` public async Task<IActionResult> Post() { byte[] array = new byte[Request.ContentLength.Value]; using (MemoryStream memoryStream = new ...

C# 7 tuples and lambdas

With new c# 7 tuple syntax, is it possible to specify a lambda with a tuple as parameter and use unpacked values inside the lambda? Example: ``` var list = new List<(int,int)>(); ``` normal way to...

23 May at 12:26

ServiceStack Utility to read from Custom Config Sections

Is there any ServiceStack utility that can read from custom config sections. ServiceStack has IAppSettings which makes it easy to read from appSettings in a config file. I am wondering if ServiceStack...

28 Mar at 22:3

How to switch on System.Type?

In C# 7+, can I switch directly on a `System.Type`? When I try: ``` switch (Type) { case typeof(int): break; } ``` it tells me that `typeof(int)` needs to be a constant expressi...

13 Dec at 11:21

'csc' is not recognized as an internal or external command, operable program or batch file

I'm fairly new to C# and I'm trying to use cmd to compile a basic hello world file called `test.cs`. It contains the following: ``` // Similar to #include<foo.h> in C++, includes system namespaces in...

28 Mar at 21:44

Building msbuild 15 project programmatically

I'm trying to build a simple C# 7 class library project created with VS2017. MSBuild from framework assemblies is outdated, so I'm referencing `Microsoft.Build`, `Microsoft.Build.Engine` and `Micros...

28 Mar at 19:38

Can I use moq Mock<MyClass> to mock a class, not an interface?

Going through [https://github.com/Moq/moq4/wiki/Quickstart](https://github.com/Moq/moq4/wiki/Quickstart), I see it Mock an interface. I have a class in my legacy code which does not have an interface....

10 Mar at 00:46

ASP.NET Web Api - Startup.cs doesn't exist

I have an ASP.NET Web Api solution which doesn't contain a Startup.cs class. I presume this is because the solution wasn't created as an MVC solution. All the code for the startup is defined in the G...

Error using ServiceStack.Text to deserialize derived generic type

I'm using ServiceStack.Text to serialize/deserialize objects before storing them in Redis, but i've come across some objects, that won't deserialize as expected. I have a base type (bit of legacy cod...

What does a question mark mean in C# code?

I've seen code like the following unrelated lines: ``` Console.Write(myObject?.ToString()); return isTrue ? "Valid" : "Lie"; return myObject ?? yourObject; int? universalAnswer = 42; ``` There see...

9 Jul at 20:42

Question Mark (?) after session variable reference - What does that mean

I have had a code snippet comes to modify. In there i found this such syntax. ``` Session("LightBoxID")?.ToString() ``` I didn't understand what is that Question mark there means. No googling help...

28 Mar at 16:46

How do I transform appsettings.json in a .NET Core MVC project?

I've added additional json config files to my project ``` appsettings.DEV.json appsettings.QA.json ``` and loaded them in the `Startup` function based on the environment: ``` public Startup(IHost...

28 Mar at 16:45

Can we deploy a C# 7 web app to Azure using Kudu?

Since Visual Studio 2017 is released and we can use the new C# 7 features I expected this will work when deploying on Azure Web apps. Unfortunately we're seeing compile errors when using continuous d...

Using ServiceStack Ormlite global filters with Session

I want to alter the example found [here](https://github.com/ServiceStack/ServiceStack.OrmLite#global-insert--update-filters) so that modifyby is populated with the session's username every time a chan...

28 Mar at 14:0