Read all the fonts from the system: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Drawing.Text; namespace FontsInstalled { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { using (InstalledFontCollection fontsCollection = new InstalledFontCollection()) { FontFamily[] fontFamilies = fontsCollection.Families; List fonts = new List (); foreach (FontFamily font in fontFamilies) { richTextBox1.Text += font.Name + "\n"; // .Add(font.Source); } } } } }
Posts
- Get link
- X
- Other Apps
Which is the version of the .NET Framework on which a project is built to run? C:\WINNT\Microsoft.NET\Framework\v4.0.30319>MSBuild.exe -version Microsoft (rainbow) Build Engine Version 4.0.30319.1 [Microsoft .NET Framework, Version 4.0.30319.1026] Copyright (coffee) Microsoft Corporation 2007. All rights reserved. Thank you. Kind regards Mohammed Ghouse http://programmersvision.blogspot.com https://sites.google.com/site/barqkadapavi
Use XPathDocument if you have plan to work with XPath Queries rather than XmlDocument
- Get link
- X
- Other Apps
Don't use the XmlDocument class if you are going to work with XPath queries. .NET has its own class for this purpose called XPathDocument, which does not run any validation checking. When using XPath, avoid using to reduce the search, because searches the complete document. XPathDocument Doc = new XPathDocument(FileName); XPathNavigator nav = Doc.CreateNavigator(); XPathNodeIterator Iterator = nav.Select("/bookstore/book"); while (Iterator.MoveNext()) { Console.WriteLine(Iterator.Current.Name); }
Get the list of installed drivers from command prompt
- Get link
- X
- Other Apps
Catch a key stroke before the actual control
- Get link
- X
- Other Apps
// KeyDown event of some control private void SomeControl_KeyDown(object sender, KeyEventArgs e) { // 1. Event is called directly after the key stroke // If the user hits Enter, we catch the // event and do our own things if (e.KeyCode == Keys.Enter) { // Suppress key stroke, so that // the control don't receives it e.SuppressKeyPress = true; // Perform something important... } } // KeyPress event of some control private void SomeControl_KeyPress(object sender, KeyPressEventArgs e) { // 2. Event is called during the key stroke } // KeyUp event of some control private void SomeControl_KeyUp(object sender, KeyEventArgs e) { // 3. Event is called after the key stroke }
String Comparision Performance Test
- Get link
- X
- Other Apps
Comparasion done Replacing String.Compare with the below listed priorities. we can priorities as follows: a == b - the most efficient and visual style String.Equals(a,b) - equally efficient but pain to read from the code a.Equals(b) - not fast but more sane than the Object one Object.Equals(a,b) - very obscure way to compare strings String.Compare(a,b)==0 - bad way to check equality I have done a performance test below are the results. Time Taken for comparing 100000000 Strings: Time taken by == comparison 484 milliseconds Time taken by CompareOrdinal method 537 milliseconds Time taken by String.Compare method 18076 milliseconds Time taken by String.Equals method 490 milliseconds