background preloader

C#

Facebook Twitter

Visual C# Tutorials at C. C# Programming Guide. This section provides detailed information on key C# language features and features accessible to C# through the .NET Framework. Most of this section assumes that you already know something about C# and general programming concepts. If you are a complete beginner with programming or with C#, you might want to visit the Getting Started with C# interactive tutorial, where no prior programming knowledge is required.

For information about specific keywords, operators and preprocessor directives, see C# Reference. For information about the C# Language Specification, see C# Language Specification. Program sections Inside a C# Program Main() and Command-Line Arguments Language Sections Statements, Expressions, and Operators Types Classes and Structs Interfaces Enumeration Types Delegates Arrays Strings Properties Indexers Events Generics Iterators LINQ Query Expressions Lambda Expressions Namespaces Nullable Types Unsafe Code and Pointers XML Documentation Comments Platform Sections Attributes Collections Reflection. C# Tutorial. >>Earn money through freelance projects! C# Tutorial C# Group C# Resources Community Site You are Here: Home > C# > C# Tutorial C# Tutorial Home text zoom Start tutorial C# Tutorial Home Introduction to C# This is a C# tutorial to help a developer understand what is CSharp.

Share This ... C# Discussion ...more C# Source Code ...more C# Related Tutorials ...more New C# Resources ...more Member Panel remember me Explore VisualBuilder Popular Links Popular Links Popular Links Popular Links Copyright © 2014 VisualBuilder. A Beginner's Tutorial - Type Casting and Type Conversion in C#

Download source - 6.1 KB Introduction This small article discusses about type casting in C#. We will look into how implicit type casting works, when will we need explicit casts and how can we enhance our user defined types to support implicit or explicit casts. Background Programming in any language will involve manipulation of in-memory data. From the compiler's perspective, assigning value of one type of variable to another is perhaps not a valid operation(except for implicit casts).

For the above mentioned reasons, C# has provided the possibility of casting one data type to another. Using the code Let us look at different ways of casting/conversion possible in C#. Implicit casts Let us start by looking into the conversions that are done automatically by C#. Built-in numeric types, widening conversions.Reference types, Derived class to base class. The built in numeric types can be assigned to each other if a narrow type is being assigned to wider type. Int i = 10; long l = i; Explicit casts.

Visual C# .NET - Getting Started. What we're going to do first is to create a very simple programme, so that you can see what makes up a C# .NET project. By the end of this chapter, you'll have learnt the following: How to create new projects What the Solution Explorer is The various files that make up of a C# .NET project How to save your work How to run programmes The importance of the Main statement The simple programme we'll create is called a Console Application. We won't be doing much else with this type of application, as this is a book about Windows Applications. Off we go then! Open the Visual C# Express software from your programs menu. Click here to see the image in a new popup window (37K) If you have Visual Studio Express 2012/13, your opening screen will look like this: C# .NET 2012 ( new popup window - 30K ) When you're looking at this piece of software for the first time, it can seem hugely complex and daunting.

A Simple C# Console Application A Console Application is one that looks like a DOS window. Learning C# by Example. The obligatory example for any language, using System ; public class HelloWorld { public static void Main ( string [] args ) { Console . Write ( "Hello World! " ); } } Raw CSharp compiler You can compile c# using the command line version and then run the new program by entering You can get Nant, a build tool like the old 'make', from . Reading Stuff Read an entire file into a string Read a file with a single call to sReader.ReadToEnd() using streams public static string getFileAsString ( string fileName ) { StreamReader sReader = null ; string contents = null ; try { FileStream fileStream = new FileStream ( fileName , FileMode .

Read all the lines from a file into an array Read a file line by line with no error checking Useful if the file may be really large. Writing Stuff Easy writing all text to a file WriteAllText will create the file if it doesn't exist, otherwise overwrites it. Write a line to a file using streams Access files with "using" s . Or DateTime .