Relative Content

Tag Archive for c#.net

C# Task issue with Powershell and TaskScheduler

I am writing a C# library (.NET 4.6.1) that will use Tasks to be able to run several snippets of code in the background. This library will be called by a Powershell script that is triggered from a TaskScheduler item

Expected semicolon inside if statement

I’ve borrowed some code from another question and answer online (accepted as a working solution), but my compiler seems to expect some extra characters and I can’t see why.

Expected semicolon inside if statement

I’ve borrowed some code from another question and answer online (accepted as a working solution), but my compiler seems to expect some extra characters and I can’t see why.

Expected semicolon inside if statement

I’ve borrowed some code from another question and answer online (accepted as a working solution), but my compiler seems to expect some extra characters and I can’t see why.

Activator.CreateInstance throwing exception for Anonymous Type object with parameters

private dynamic GetAnonymousItemData(Type anonType, OracleDataReader reader) { var item = new object[reader.FieldCount]; for (int i = 0; i < reader.FieldCount; i++) { item[i] = reader[i]; if (i == 0) { item[i] = Convert.ToInt64(reader[i]); } else { item[i] = Convert.ToString(reader[i]); } } var temp = new object[] { 1, “Test”, “test” }; dynamic? itemTestTemp = Activator.CreateInstance(anonType, […]

Configuration not loaded from environment variables

I have some values for the application configuration in appsettings.json file and some values in environment variables. I expect the configuration key values to be populated with the values from the environment variable, but it is just empty. Can you please help me?

How to Structure Project

Just learning .NET and compared to other stacks, the project structure is very confusing to me.