-
The below extension method will help us to convert a generic list to DataSet public static class DataSetExtension { public static DataSet ToDataSet<T>(this List<T> list) { Type type = typeof(T); DataSet ds = new DataSet(); DataTable dt = new DataTable(type.Name); ds.Tables.Add(dt); var propertyInfos...
-
The below extension method will help us to convert a generic list to DataTable public static class DataTableExtension { public static DataTable ToDataTable<T>(this List<T> list) { Type type = typeof(T); DataTable dt = new DataTable(type.Name); var propertyInfos = type.GetProperties().ToList...
-
In an operating system, a Memory Mapping file are virtual storage place which has direct byte to byte correlation between the Virtual Address Space and the corresponding physical storage. So when we access the Virtual Address space via a memory mapping file we are directly communicating with the kernel...
-
This in continuation with previous post on QuickFix which explain how to connect to FIX Server and send order to Fix Server. I don't have any environment to test now. I just want to give idea about how can we get market price from FIX server if broker/exchange is sending market price in FIX messages...
-
Interfacing C# application (basic CRUD using functions) with PostgreSQL(9.1.0-1) and NpgSql(2.0.11.91) as .Net data provider - Part 2 PostgreSQL does not support the traditional way of creating stored procedure found in other databases like Sql Server, Oracle etc. It lacks the famous Create Procedure...
-
In this article we will look into how to interface C# application with PostgreSQL(9.1.0-1) and PgAdmin III(1.14.0) which was release on Sept 9, 2011.This powerful RDBMS is there for a long time and it is free also which indicates that we will not have any licensing issue if we use it in our commercial...
-
What’s wrong with the following code? var names = new HashSet<string>(StringComparer.OrdinalIgnoreCase); ... if (names.Contains(sqlCommand.ExecuteScalar()) This code is intended to check whether the result of a SQL query is contained in a case-insensitive collection of names. However...
-
This is part 2 in a series about C# 5’s new caller info attributes; see the introduction . The [CallerLineNumber] attribute tells the compiler to use the line number of the call site instead of the parameter’s default value. This attribute has more corner cases than [CallerFileName]. In particular...
-
A few weeks back I read this question on Stackoverflow . The question was about applying covariance / contravariance (or variance for short) to the Autofac dependency injection container. The question triggered me to think about variance support in the Simple Injector (btw, version 1.2 has just been...
-
Well, now getting deeper into the facts, lets talk about how objects are created in .NET and how type system is laid out in memory for this post in my Internals Series . As this is going to be very deep dive post, I would recommend to read this only if you want to kill your time to know the internal...
Posted to
Abhishek Sur
by
Abhishek Sur
on
09-26-2011
Filed under:
Filed under: beyondrelational, C#, CodeProject, .NET 3.5, .NET 4.0, architecture, .NET, internals, .NET Memory Management, Finalize, Patterns, Memory Allocation
-
As many of my followers requested me to write few things that I missed out from the Internals Series , I should continue with it. In this post, I will cover the internals of Interface implementation and mostly talk about explicit interface implementation, as most of the developers seems to be in confusion...
-
One common question about ASP.Net MVC is how to make “default” controller. Most websites will have a Home controller with actions like About , FAQ , Privacy , or similar pages. Ordinarily, these actions can only be accessed through URLs like ~/Home/About . Most people would prefer to put...
-
Part 1 is here Some languages have better ways to pass boolean parameters. C# 4.0, and all versions of VB, allow parameters to be passed by name. This allows us to write much clearer code: //C# 4.0: UpdateLayout(doFullLayout: false) 'VB.Net: UpdateLayout(doFullLayout:=False) Without requiring...
-
Have you ever written code like this: public void UpdateLayout(bool doFullLayout) { //Code if (doFullLayout) { //Expensive code } //More code } This pattern is commonly used when some operation has a “cheap” mode and an “expensive” mode. Other code will have calls like UpdateLayout(false) and UpdateLayout...
-
In this article we will read a word document and in that we will search if any valid email address is there and if so we will pick up those The content of the word file is as under Hello How r u Email: mail3456@gg.com Another email is aaa@zz.com And not a valid email as invalid@.com I am using dotnet...