Code Snippets

  

C# Source Code


Welcome to Dream.In.Code
Become a C# Expert!

Join 137,213 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 2,272 people online right now. Registration is fast and FREE... Join Now!





Reverse a string

This is a snippet for reversing a string

Submitted By: PsychoCoder
Actions:
Rating:
Views: 360

Language: C#

Last Modified: August 5, 2008

Snippet


  1. public string ReverseString(string str)
  2. {
  3.     char[] array = new char[str.Length];
  4.     int len = str.Length - 1;
  5.     for (int i = 0; i <= len; i++)
  6.     {
  7.         array[i] = str[len - i];
  8.     }
  9.     return new string(array);
  10. }

Copy & Paste


Comments


There are currently no comments for this snippet. Be the first to comment!

Add comment


You must be registered and logged on to </dream.in.code> to leave comments.





Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month