.Net Framework

Methods to verify, are DataTables or DataSets the same.

I wanted to verify, are DataTables in DataSets the same. I found a few similar implementations on StackOverflow, but the one that I've selected (http://stackoverflow.com/q... didn't work and returned unexpectedly false, when comparing two cells with the same values tbl1.Rows[i][c] 2 object {long} tbl2.Rows[i][c] 2 object {long} tbl1.Rows[i][c] == tbl2.Rows[i][c] false I found, that it should be used Equals instead of ==. Equals(tbl1.Rows[i][c], ......

Number of Unit test projects in Visual Studio solution

Some time ago I have discussion with my co-worker how to organize test projects. Should we have a single test project that does all sorts of things and references every project?It is good to have one integration test dll, but for unit tests, what is the point merging everything into one.In ideal world I agree that small independent projects are better. Unfortunately we have solution size limitations From http://stackoverflow.com/qu... ......

My DateTimeHelper class

Previously I've posted a few Helper Classes . This post describes my DateTimeHelper class. using System; using System.Collections.Generic; using System.Text; using Microsoft.VisualBasic.Compi... using Microsoft.VisualBasic; using System.Diagnostics; public static class DateTimeHelper { public static DateTime DateAndTime(DateTime dateValue, DateTime timeValue) { DateTime time2; time2 = new DateTime(dateValue.Year, dateValue.Month, dateValue.Day, timeValue.Hour, timeValue.Minute, timeValue.Second); ......

My CollectionsHelper class

Previously I've posted a few Helper Classes . This post describes my CollectionsHelper class. ///<summary> /// //from http://diditwith.net/PermaL... ///</summary> ///<example> ///<code> ///</code> ///</example> public static class CollectionsHelper { /*When C# extensions will be available( promised in C# 3, add this keyword to parameter * public static bool IsNullOrEmpty(this ICollection c) //from http://diditwith.net/PermaL... ......

My RegexMatchsHelper class

Previously I've posted a few Helper Classes . This post describes my RegexMatchsHelper class I also added a few related links: Use Regular Expressions to Constrain Input in ASP.NET using System; using System.Diagnostics; using System.Text.RegularExpressi... ///<summary> /// Summary description for RegexMatchs. ///</summary> public class RegexMatchsHelper { public RegexMatchsHelper() { // // TODO: Add constructor logic here // } // public static void RetrieveMatchedStringTest() // { // ......

My StreamHelper class

Previously I've posted a few Helper Classes . This post describes my StreamHelper class using Microsoft.VisualBasic; using System; using System.IO; using System.Reflection; using System.Text; using System.Diagnostics; public class StreamHelper { // 'See also FxLib Author: Kamal Patel, Rick Hodder // 'Find the first entry of sToFing and returns the string after it // 'See also FxLib StringExtract (and StuffString) // Methods public StreamHelper() { } #region "Stream and Resources Functions" //C# version ......

My HttpWebRequestHelper class

Previously I've posted a few Helper Classes . This post describes my HttpWebRequestHelper class: using System; using System.Text.RegularExpressi... using System.IO; using System.Diagnostics ; using System.Net; namespace FSHelperLib { using System; using System.Text; // clarification from http://www.dotnetsmart.com/... // System.Web.HttpRequest is a class used on the server and inside an ASP.NET application. It represents the *incoming* request from a client. // System.Net.HttpWebRequest ......

My EnumHelper class

Previously I've posted a few Helper Classes . This post describes my EnumHelper class. The class uses other helper classes, in particular CollectionsHelper Related links: Overriding ToString on enum, Mapping Text to Enum entries . Enum Helper Class Using Generics , My new little friend, Enum<T>, Making C# enums more usable - the Parse() method https://connect.microsoft.c... using System; using System.Collections.Generic; using System.Text; ......

Invoke Executable as custom action during Install.

I've used MS Installer class to provide custom actions during setup in a few projects(e.g.see Using VS 2005 Web Setup Project with custom actions). However if you have some complex logic to do as a part of setup, it is possible that some exception will occur. I don't like to hide exceptions, and they are shown to the user,causing installation to rollback. It is not good, becuse sometimes user wants to ignore exception and use installation even if some custom action failed. I found that moving code ......

My FileHelper class

I've posted a few code snippets and some people noticed that there are references to unresolved methods.I am using a few helper classes. This post describes my FileHelper class: System.IO; /// <summary> /// Summary description for FileHelper. using /// See also StreamHelper class methods, e.g. SaveStringToFile,SaveToFile /// </summary> public static class FileHelper { public static string GetFileExtensionWithoutDot(... fileName) { string sExt=Path.GetExtension(file... if ((null==sExt) ......

Encode Invalid characters in Visual SourceSafe file names.

Some time ago I had to create the utility to rename files with special characters to allow them to be inclyuded in Visual SourceSafeI've used VBeXpress generator, that had templates with ‘%’ in file names. Unfortunately the names with ‘%’ like %%Project.Name%%.sln are not acceptable by VSS due to invalid VSS syntax. This utility copies changed templates to files with encoded names,acceptable by VSS. It's allowed to check-in/check out individual files(with encoded names) and view thier changes/history. ......

Serialization error when property is declared as base class, but populated by derived class

I've receive quite generic error Message : Type 'MyclassType' with data contract name 'MyclassType:http://schemas... is not expected. Consider using a DataContractResolver or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.Type : System.Runtime.Serializatio... mscorlib, Version=4.0.0.0, Culture=neutral, ......

Upgrading PostSharp from ver 2.1 to new version 3.0

I was upgrading our solutions from PostSharp 2 to PostSharp 3. The small solution based on cache attribute from http://cache.codeplex.com/ was upgraded without any problems.Upgrading my main solution by installing nuget package PostSharp also was quite well. The only annoying thing was that installer added RequiresPostsharp.cs file to all projects, that already had SkipPostSharp=true setting and I had manually remove themThe issue was reported athttp://support.sharpcraft... ......

AddIfNotNull collection extensions

I want to post a few recently created collection extensions to write in one line, what otherwise takes 2 or more public static void AddIfNotNull( this IList coll, T newItem) where T : class { if (newItem != null) { coll.Add(newItem); } } public static void AddRangeIfNotNullOrEmpty( this List coll, IEnumerable newItems) where T : class { if (!newItems.IsNullOrEmptySeq... { coll.AddRange(newItems); } } public static void AddIfNotContains( this Dictionary dictionary, TKey key, TValue value) { if ......

Do NOT Change "Copy Local” project references to false, unless understand subsequences.

To optimize performance of visual studio build I've found multiple recommendations to change CopyLocal property for dependent dlls to false,e.g. From http://stackoverflow.com/qu... CopyLocal? For sure turn this offhttp://stackoverflow.com... set the Copy Local property to false and enforce this via a custom msbuild stephttp://codebetter.com/p... ......

My ListOfStringsHelper class

I am using a few helper classes. This post describes my ListOfStringsHelper class. #region Namespace Importsusing System;using System.Collections.Generic;... System.Globalization;using System.Linq;using System.Text;using System.Diagnostics;#endregion //Namespace Imports namespace Common{// using System.Collections; //See also StringArrayHelper.cs, CollectionsHelper.cs public static class ListOfStringsHelper { public static bool StringContainsAnyFromList(L... patternsList, string sMsg) ......

My EnglishGrammerHelper class

The class below is used to create adjustable messages using System; /// Summary description for EnglishGrammerHelper. /// </summary> public class EnglishGrammerHelper { public EnglishGrammerHelper() { // // TODO: Add constructor logic here // } /// <summary> /// Compiles sentence with person,verb and rest of the sentence /// </summary> /// <param name="person"></param... /// <param name="verb"></param> /// <param name="restSentence"><... /// ......

DataSetHelper Class that I am using

Previously I've posted a few Helper Classes . This post describes DataSetHelper class, that mostly based on series of MSDN articles. However I did some modifications(e.g see posts DataSetHelper.SelectDistinct method for multiple columns and “Handling missing source columns in DataSetHelper.InsertInto method” ) using System; using System.Data; using System.Data.SqlClient; using System.Diagnostics; using System.Collections; using Microsoft.ApplicationBlocks... using System.Collections.Generic; namespace ......

My StringArrayHelper class

Previously I've posted a few Helper Classes . This post describes my StringArrayHelper class: using Iesi.Collections; using Microsoft.VisualBasic; using Microsoft.VisualBasic.Compi... using System; using System.Collections; using System.Runtime.CompilerServ... using System.Xml; using System.Text; public static class StringArrayHelper { //created from CollectionsHelper.cs // Methods //'ignore new string, if already exist in the array // empty string considered as separate entry // function ......

EntLIb editor corrupts config files

I've tried to use Microsoft Enterprise Library(EntLIb) editor, as it was suggested in http://weblogs.asp.net/suku... but after changes all comments in config files were removed. Always consider to move any Enterprise Library configurations to a separate file before editing ......

Full .Net Framework Archive

«July»
SunMonTueWedThuFriSat
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789