I got trolled once because of the way my website looked. I must admit, it did age a bit, but at the time I built it, using ADO.NET, ASP.NET Webforms (ASPX) and Master Pages, it was a pretty cool and sophisticated website for it’s time. Here is a tribute to my old C# blog look […]
Read More →Tags: C#
Adding a context menu to a treeview Part 2
In my previous post I showed you how I added a context menu to a treeview. I had a new requirement that wanted a treeview property to contain a flag that could be turned on or off and that the value be displayed in the context menu. First I added the menuItem to the XAML. […]
Read More →Adding images to a Tree View in WPF using C#
Like I’ve said before, once you find what your looking for, it is easy to find examples about how to use and implement it. I had this again while trying to add images to a treeview. The term I was looking for, while trying to find a solution was ValueConverter. In this solution I will […]
Read More →How to search a Lucene.Net index in C#
I used this code to perform a search of a Lucene.Net index. Lucene.Net.Store..Directory directory = Lucene.Net.Store.FSDirectory .Open(new DirectoryInfo(textBoxSearchIndex.Text)); Lucene.Net.Analysis.Analyzer analyzer = new Lucene.Net.Analysis.Standard .StandardAnalyzer(LuceneUtil.Version.LUCENE_29); Lucene.Net.Search.Searcher searcher = new Lucene.Net.Search .IndexSearcher(LuceneIndex.IndexReader .Open(directory, true)); Lucene.Net.Search.Query query = new Lucene.Net.QueryParsers .QueryParser(LuceneUtil.Version.LUCENE_29, “contents”, analyzer) .Parse(textBoxSearch.Text); Lucene.Net.Search.Hits hits = […]
Read More →Treeview with checkbox in WPF
On one of my projects I had to provide treeview selection functionality. I searched the internet and pulled everything I could into a this single resource. I wasn’t able to find 1 post that provided all the details and source code to do what I needed. Now there is one and if you find it, […]
Read More →Strings in C#
The String class in .Net has many capabilities. Below is a list of some string methods I use frequently in my development projects. Even when I have completed this list, I am sure it will over cover 5% of the capabilities within the String class. After reading this, I suggest you look over the MSDN […]
Read More →Projects and Solutions in .Net (.csproj and .sln)
Holistic approach or high level approach are common phrases you will hear when beginning the design of a new system or the start of a new project that will modify or enhance an existing program. Therefore, when you begin a new project, start from the solution context. This means, know what the program does end-to-end […]
Read More →Booleans and Bools in C#
In a job interview I had once, I was asked, “How do you store a Boolean in a database?” My first reaction was to say, True, False, 0, 1, Y or N. However, this question has some depth to it. I do not know why, if you do let me know, but there are no […]
Read More →Constants and Enums in C#
Constants come in handy when you need to store values that will be used frequently within the system and at the same time will not change often, if ever. You want to avoid hard coding values in you code. It makes maintenance and debugging very difficult. You can create a constants class and then access […]
Read More →How to use Data Parallelism from the Task Parallel Library in C#
I wrote a program a few months back that populated a dropdown list with contents from a class using reflection. I used a normal for each statement. [sourcecode language=”csharp” padlinenumbers=”true” autolinks=”false” gutter=”false” toolbar=”false”] foreach (Type type in assembly.GetTypes() .OrderBy(f => f.MetadataToken)) { if (type.Namespace != null) { if (!type.Namespace.ToLower().StartsWith(“namespace”)) combobox1.Add(new ComboBoxClass(type.Name, type.FullName)); } } [/sourcecode] […]
Read More →