Hello friends, Today we will go though a useful method of datetime class called TryParseExact. You can use this method to specify the pattern in which you want user to enter the dates. There are two overloads as following. TryParseExact(String, String, IFormatProvider, DateTimeStyles, DateTime)TryParseExact(String, String[], IFormatProvider, DateTimeStyles, DateTime) Example: var isValid = DateTime.TryParseExact(Convert.ToString(value), “d MMM yyyy”,… Continue reading Enforcing date pattern with DateTime.TryParseExact method
Month: December 2018
Efficiently handling DBNull in C#
Hello friends, Let’s go through about DBNull today. DBNull represents a nonexistent value returned from the database. In a database, for example, a column in a row of a table might not contain any data whatsoever. That is, the column is considered to not exist at all instead of merely not having a value. A DBNull object… Continue reading Efficiently handling DBNull in C#
Working with Factory Method Pattern
Hello friends, Today we will go through another creational design pattern called Factory Method. Before talking about its implementation let’s begin with defining it. Factory method pattern is similar to simple Factory pattern with a few difference. Unlike Simple factory, here client doesn’t call the factory class instead it calls the factory interface. Factory interface… Continue reading Working with Factory Method Pattern