C#
  Home arrow C# arrow Page 6 - C# Simplified, part 2: Methods & Programmi...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
C#

C# Simplified, part 2: Methods & Programming Constructs
By: Anand Narayanaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 16
    2005-05-10

    Table of Contents:
  • C# Simplified, part 2: Methods & Programming Constructs
  • Declaring methods with parameters
  • Overloading Methods
  • Different types of programming constructs in C#
  • Different types of looping statements in C#
  • break Statement

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    C# Simplified, part 2: Methods & Programming Constructs - break Statement


    (Page 6 of 6 )

    This statement is used to terminate a loop abruptly. You have already seen the usage of this statement while discussing the switch-case construct. If the condition is true and the compiler finds a break statement, then the program will stop at that point. In listing 2.14, a loop is created to print numbers from 1 to 10. But since I have specified the break statement inside an if clause, the program will terminate after printing the numbers from 1 to 5. 

    Listing 2.14

    using System;

    class Breaks

    {

    public static void Main()

    {

    for(int I = 1; I<=10; I++)

    {

    Console.WriteLine(I);

    if(I==5)

    {

    break;

    }

    }

    }

    }

    Summary

    In this part of the series, you have seen the working of different types of methods with the help of relevant source codes. The article also discussed the various programming constructs, including the different lopping statements such as for, while, do-while, and so forth. In the next article, you will learn about the different escape characters and other important topics, such as arrays.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

     

    C# ARTICLES

    - C# and XML
    - Pointers and Arrays in C#
    - C# 3.0 Extension Methods
    - Overloading Operators in C#
    - Iterators and Nullable Types
    - Patterns and Iterators in C#
    - C# Exceptions
    - Methods in C#
    - Delegates and Events in C#
    - Advanced C#
    - Working with Regular Expressions in C#
    - Sending Simple E-Mail in C#
    - Building C# Comparable Objects: IComparable ...
    - Color Transformation Applications in C# GDI+...
    - Performing Color Transformation Operations i...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
    Stay green...Green IT