Category Archives: c#

C# Lists in Lists – Getting all inner values, or the unique inner values

Getting the inner value of a list inside a list can seem complicated in C#, but LINQ makes it easier. But first let’s make a list in a class, and then make a list of the class with the list … Continue reading

Posted in .net, c#, General .NET | Tagged , , | Leave a comment

Sitecore create custom Content Editor Warnings using Conditions and Rules

The Content Editor Warnings are these yellow boxes that hover over your content in the Content Editor in Sitecore: In the old days we would make them by hooking into the getContentEditorWarnings pipeline. Nowadays we use the Sitecore Rules engine. … Continue reading

Posted in c#, General .NET, Sitecore 5, Sitecore 6, Sitecore 7, Sitecore 8, Sitecore 9 | Tagged , , , , , , | Leave a comment

C# and Microsoft.ML. Removing words from sentence. Getting started with Machine Learning

Microsoft.ML is the NuGet package for ML.Net, Microsoft’s open-source Machine Learning framework. In this introduction I will create a stopword engine, capable of removing unwanted words from a sentence. I know that it is overkill to use machine learning to … Continue reading

Posted in .net, .NET Core, c#, General .NET | Tagged , , , | Leave a comment

Run parallel tasks in batches using .NET Core, C# and Async coding

If you have several tasks that you need to run, but each task takes up resources, it can be a good idea to run the tasks in batches. There are a few tools out there, and one of them is … Continue reading

Posted in .net, .NET Core, c#, General .NET | Tagged , , | Leave a comment

C# Working with Namespaces in XDocument and XML

XDocument is your old XML friend in C#, and it allows you to create or manipulate XML documents. To work with namespaces, you must use the XNamespace class. This is an imaginary XML document (a Google Merchant Feed formatted one) … Continue reading

Posted in .net, .NET Core, c#, General .NET | Tagged , , , , | Leave a comment

Write to SOLR from .NET Core

.NET Core supports the SOLR index through the SolrNet.Core NuGet packages. Here is how you update the index. STEP 1: THE NUGET PACKAGES You need the following NuGet packages: SolrNet.Core SolrNet.Microsoft.DependencyInjection STEP 2: CREATE A MODEL CLASS CONTAINING THE PROPERTIES … Continue reading

Posted in .net, .NET Core, c#, General .NET | Tagged , , , | Leave a comment

Sitecore publishItem pipeline – handling missing delete when publishing

When publishing items in Sitecore, the publishItem pipeline is called for each item that must be published, or unpublished. Except for children of items that have been deleted. Let’s take this example: If I publish the top item, the publishItem … Continue reading

Posted in c#, General .NET, Sitecore 7, Sitecore 8, Sitecore 9 | Tagged , , , | Leave a comment

Sitecore read from Custom Database

It is very easy to read from a custom database in your Sitecore code. STEP 1: ADD THE CONNECTIONSTRING TO CONNECTIONSTRINGS.CONFIG This is an example of a .config file that transforms the connection strings for existing Sitecore databases (like the … Continue reading

Posted in c#, General .NET, Sitecore, Sitecore 6, Sitecore 7, Sitecore 8, Sitecore 9 | Tagged , , , | Leave a comment

HttpClient follow 302 redirects with .NET Core

The HttpClient in .NET Core will not automatically follow a 302 (or 301) redirect. You need to specify that you allow this. use the HttpClientHandler to do this: Now your code will follow up to 2 redirections. Please note that … Continue reading

Posted in .net, .NET Core, c#, General .NET | Tagged , , , , | Leave a comment

Create a custom Azure Dashboard Tile Using an Azure Function and Markdown Format

The tiles on an Azure Dashboard will only display data from Azure itself. So if you have data from the outside, like a database, you need to make a few workarounds. Now, you cannot make your custom tile as pretty … Continue reading

Posted in .NET Core, c#, Microsoft Azure | Tagged , , , , | 1 Comment