This article guides you to serialize object to XML in C#. Below is a complete example to show writing the data stored in a class object to an XML file. Table of ContentsHow to Write Object Data to an XML File in C# ( Serialize C# Object to XML File)?Code Sample – Serialize Object to XML in C# […]
What is the use of Application.EnableVisualStyles()?
The Entry point method of C# Winform application looks as below, Here [STAThread] attribute decoration is essential to mark your application state as single-threaded apartment style.For details of STAThread attribute read What STAThread Attribute does? Also check what is SetCompatibleTextRenderingDefault(false) ? Here we look into Application.EnableVisualStyles() Table of ContentsWhat is EnableVisualStyles()? Why Application.EnableVisualStyle Method Required?Summary What […]
XPATH With Default Namespace In C# – XPathNavigator
This article explains the sample C# code with XPathNavigator to select an XML element from an XML file which is having a default namespace.Consider the sample XML file with namespace(xmlns) defined , See the console application sample given below which selects all the City Elements of the State which is having Name attribute value ‘Karnataka’.XPathNavigator […]
String Value Enum with Space in between – Description Attribute
Enum with spaces C#: If you give a space in string value of Enum, it would generate a compilation error. Single-word enum string value is a normal scenario and straightforward handle. But, how to have an enum string value with multiple words Table of Contents Enum values with spaces in C#Associating Strings with enums in […]
What Is SetCompatibleTextRenderingDefault (false)
This article is just to give you a brief idea about SetCompatibleTextRenderingDefault and what happens if we pass true instead of false. Table of ContentsWhat is UseCompatibleTextRendering property? | What Is SetCompatibleTextRenderingDefault? Application.SetCompatibleTextRenderingDefault MethodSummary What is UseCompatibleTextRendering property? | What Is SetCompatibleTextRenderingDefault? If you’re using Visual C# 2005 or later, the Program.cs file will generate an […]
How To Create Custom Control in C# Windows Forms
Custom controls are specialized controls in .NET derived from Control class. In this article, we explain the step by step process of creating a custom control in C# WinForms application. Table of ContentsCustom Control in C# WinformsUsercontrolsInherited controlsOwner-drawn controlsC# Custom Button ControlHow to Use the Custom Control in C#Summary Custom Control in C# Winforms We can have the […]