User Profile

Collapse

Profile Sidebar

Collapse
mmsaffari
mmsaffari
Last Activity: Oct 5 '11, 12:13 PM
Joined: Oct 5 '11
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • VB string.left and string.right as C# Extension methods on string

    Perhaps these 2 tiny methods I'm sharing here come handy to someone.
    Code:
    		public static string Left(this string input, int length) {
    			string result = input;
    			if (input != null && input.Length > length) {
    				result = input.Substring(0, length);
    			}
    			return result;
    		}
    
    		public static string Right(this string input, int length) {
    			string result = input;
    			if
    ...
    See more | Go to post
    Last edited by Niheel; Oct 5 '11, 03:59 PM. Reason: Can you post an explanation of what they do and how to use them? Insights have to more like articles than just code.

  • mmsaffari
    replied to How to convert int to datetime in c#?
    Depending on what those numbers are, you may use one of DateTime.FromXX X methods to convert them into the corresponding DateTime object and subtracting two DateTime objects will result in a TimeSpan object.
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...