Geeks With Blogs
Abhishek Anand Bits & Bytes about .net technology framework. performance
String Optimizations
STRING ITERATIONC# allows the characters of a string to be iterated by using a “foreach” or a simple index access within a traditional “for”In this specific case, it is much more efficient to use a traditional “for” loop for iterating over a stringOne main reason for this is due to the fact that the JIT compiler can optimize “for” loops to remove bounds checking and other operations (it cannot do this with “foreach”).Using StringBuilder ClassC# Strings are immutable objects underneath the hood, so ......

Posted On Monday, October 21, 2013 3:38 PM

Performance Gains
Using the “static” keyword Static classes can only contain static members and cannot be instantiated. So using the static keyword will make your code a bit faster since no object creation is involved.Static methods can be accessed without an instance of the class being created.Static fields are shared across all instances of that class.In-short, they are all loaded once into memory and do not require instance resolution at run-time, which reduces the amount of instructions needed to call the method.Static ......

Posted On Monday, October 21, 2013 2:52 PM

Copyright © Abhishek Anand | Powered by: