I created a simple Azure Function and now I want to connect it to a database. Check out these other articles as well. How to create an Azure Function in Visual Studio Deploy an Azure Function created from Visual Studio Check out all my Azure Function articles here I found this article also useful “Code […]
Read More →Tags: C#
Sending email from an Azure App Service using an O365 SMTP server
One of the surprises I had when I moved many of my sites from a domain hoster to an Azure Web App was that the platform only provided web services and that I had lost my SMTP services. That meant I was not able to send or receive emails from my private domains. I rushed […]
Read More →Can’t modify members because it is a foreach iteration variable, use a for loop
I had a requirement where I received a generic list from a method and needed to iterate through the the list and change a value if certain criteria were met. Initially, I decided to use a foreach statement. However that resulted in a Can’t modify members because it is a ‘foreach iteration variable’ exception. Which […]
Read More →Getting started with Lucene.Net 2.9.2 using C#
I recently started a project working with Lucene.Net. I am amazed at how simple it was to create and search indexes. I downloaded the source by pointing my TortoiseSVN (subversion) here (https://svn.apache.org/repos/asf/lucene/lucene.net/tags/Lucene.Net_2_9_2/) and performing an Import. Once I downloaded it I opened the Lucene.Net.sln solution file in Visual Studio 2010 and compiled it targeting .Net […]
Read More →How to create and search a Lucene.Net index in 4 simple steps using C#, Step 3
Perform the search. In this step we will use the query which was created using the query parser to perform the search on the index we created in step 1. The Searcher class needs to be told where the index we want to search is. We will create a directory class to hold this information […]
Read More →Var vs. Object data type in C#
Knowing which data type to use in different situations is generally a basic level decision. I mean you do not need to think very hard about storing regular numbers or storing words. I hope you don’t believe that. Actually, choosing the correct data type to store your data can have serious implication on memory, storage, […]
Read More →Convert Silverlight to WPF and WPF DataGrid in C#
Here is an example of a conversion from a Silverlight project that reads data and loads it to a DataGrid to a WPF project. Please read my previous post which covers the creation of the Silverlight project used in this example. Difference #1 Silverlight is built as a UserControl which is converted from your XAML […]
Read More →Create and Consume a WCF (Windows Communication Foundation) service using C#
Creating a simple ‘Hello World’-like WCF service is very simple with Visual Studio 2010. Open Visual Studio 2010 and select New => Project => WCF Service. Name it for example, HelloWorldWCF. It will initially create 2 files for you (IService.cs and IService.svc). Delete them. Right-click on your project and add a new WCF Service named […]
Read More →How to change an image in WPF at runtime in C#
I was doing some code that checks the number of network round trips to the database within a single transaction. I was coding it using WPF in C#. What I wanted to do was set the image in the Status Bar to a green image if the transaction took 1 trip, a yellow image if […]
Read More →How to create and search a Lucene.Net index in 4 simple steps using C#, Step 1
As mentioned in a previous blog, using Lucene.Net to create and search an index was quick and easy. Here I will show you in these 4 steps how to do it. Create an index Build the query Perform the search Display the results Before we get started I wanted to mention that Lucene.Net was originally […]
Read More →