Geeks With Blogs
Rohit Gupta Engaging talk on Microsoft Technologies ....My Resume
March 2009 Entries
Some tips on .NET Memory usage
Always try to use string.Compare() method for testing string equality and inequality use string.CompareOrdinal() method for case sensitive string comparisons when returning string from a method call insure that you never return “null” return string.Empty instead Always initialize strings to string.Empty when instantiating StringBuilder use the overloaded constructor to specify the initial capacity Prefer string.format when concatenating value types into strings 1: int number = 4545; 2: string x = ......

Posted On Friday, March 6, 2009 2:30 PM

Dispose and Finalize methods
Here are are few tips on using the IDisposable pattern and using Finalizers Implement IDiposable if accessing managed resources like SQLConnection/Command objects and not disposing them from within the method which instantiates the managed resource Implement Finalizer only if using unmanaged resources (Files, Streams, Windows Handles, Pinvoke) and not disposing them from with the method that instantiates the unmanaged resources Insure that each Type that has a finalizer is responsible for disposing ......

Posted On Friday, March 6, 2009 1:04 PM

Dynamic log fileNames with log4net
If you needed to generate dynamic logfile names with log4net then you can use the following config 1: <appender name="RollingFileAppenderV1" type="log4net.Appender.Roll... 2: <file type="log4net.Util.PatternS... value="F:\HornetFeed\%prope... /> 3: <appendToFile value="true" /> 4: <rollingStyle value="Size" /> 5: <maxSizeRollBackups value="-1" /> 6: <maximumFileSize value="5000KB" /> 7: <staticLogFileName value="true" /> 8: <countDirection ......

Posted On Tuesday, March 3, 2009 4:52 PM

Tips on using log4net RollingFileAppender
By Default we have the following values for following properties of a RollingFileAppender staticLogFileName = true countDirection = –1 rollingStyle = Composite maxSizeRollBackups = 0 // be careful with this maximumFileSize = “10MB” datePattern = ".yyyy-MM-dd" staticLogFileName indicates whether you need to keep writing (log) to the same file all the time. You will need to set it to false when using Date as the rolling style and you have large number of backups. Optionally file.log.yyyy-mm-dd for ......

Posted On Tuesday, March 3, 2009 3:50 PM

Copyright © Rohit Gupta | Powered by: