Snippet Library

Browse | Submit A New Snippet | Create A Package

Snippets by language: C#

Snippet ID Title Creator
46Code of selection sortChristian Sharif
Selection sort is very useful for all type of small data. This is one of the basic algorithms to sort data. It’s easy and simple code can make this sort more easy and simple.
I take help from Developer to help me by making this code more easy and simple so that everyone can easily implement them.
54Designing a Lexical Analyzer C# | By Milly PeelerMilly Peeler
MY Goal is to develop a simple compiler using C# tool.I'll show how easy it's implementation.

Generally, four major parts to a compiler:
1)Lexical analysis,
3)Semantic analysis,
4)and Code generation.

IN SHORT, Lexical analysis breaks the source code into its lexical units. Parsing combines those units into sentences, using the grammar (see below) to make sure the are allowable. Semantic analysis makes sure the sentences make sense, especially in areas that are not so easily specified via the grammar. Type checking is a good example. Code generation takes the output of the Parser (many times in the format of an Abstract Syntax Tree) and converts it to (virtual) machine code, assembly code, or perhaps even code in another programming language - C# is a popular target.

Lexical analysis:
Also called scanning, this part of a compiler breaks the source code into meaningful symbols that the parser can work with. Typically, the scanner returns an enumerated type (or constant, depending on the language) representing the symbol just scanned. Scanning is the easiest and most well-defined aspect of compiling.

Milly Peeler - web Developer at
56How To Write A File In C#Suzan Perry
There are a lot of different ways to read and write files that are Text Files not Binary in C#.

I just tried to implement something that is easy and uses the least amount of code, because I am going to be working with files a lot in my project. I only need something for Strings since all I need is to read and write Strings.

Suzan Perry - Web Developer at
Powered By FusionForge