C# Regex to match the word with dot
. is a special character in regex, that matches anything. Try escaping it: MatchCollection match = Regex.Matches(entireText, @”alphabet\.”);
. is a special character in regex, that matches anything. Try escaping it: MatchCollection match = Regex.Matches(entireText, @”alphabet\.”);
I faced this problem recently when I upgraded my Web Application from Entity Framework 5 to Entity Framework 6. Then, I realized that System.Data.Entity DLL needs to be removed from the application completely in order to work with Entity Framework 6. Entity Framework 6 is not part of .NET Framework anymore and therefore it is … Read more
Try Quartz.NET. It’s a decent .NET scheduler which supports CRON expressions, CRON triggers and various other means and methods to schedule tasks to be performed at certain times / intervals. It even includes a basic Quartz.NET server (Windows Application) that might fit your needs. Edit: If you can’t run applications or windows services within your … Read more
Put any control into a cell in form designer Select the control and view its properties Find “ColumnSpan” property in “Layout” section Input desired column span for this value See picture for illustration:
Well, ?. is a null-conditional operator https://msdn.microsoft.com/en-us/library/dn986595.aspx x?.y means return null if x is null and x.y otherwise ?? is a null-coalescing operator https://msdn.microsoft.com/en-us/library/ms173224.aspx x ?? y means if x == null return y, otherwise x Combining all the above helper?.Settings.HasConfig ?? false means: return false if helper == null or helper.Settings.HasConfig == null otherwise … Read more
ConcurrentBag has a constructor that takes an IEnumerable. IEnumerable<T> myEnum = … ConcurrentBag<T> myBag = new ConcurrentBag<T>(myEnum);
OrderBy(i => i.PropertyName).ThenBy(i => i.AnotherProperty) In OrderBy and ThenBy you have to provide keySelector function, which chooses key for sorting from object. So if you know property name only at runtime then you can make such function with Reflection like: var propertyInfo = i.GetType().GetProperty(“PropertyName”); var sortedList = myList.OrderBy(i => propertyInfo.GetValue(i, null)) But it will be … Read more
UPDATE 2016 Six years later things are VERY different. NHibernate is all but abandoned, other alternatives were abandoned (eg Subsonic), Entity Framework is perhaps the most common full-featured ORM, and people have been moving to micro ORMs like Dapper for years, to map from queries to objects with a minimum of overhead. The application scenarios … Read more
Yes, dynamic stops the compiler from knowing the type on any parameters, properties, or method return types. Add an explicit cast like: (MethodResult)IsValid(someObject)); The reason here is that once you enter the dynamic world in C# you are going into late binding. The compiler can’t verify this code because it can no longer use any … Read more
What is your shutdown mode? If it’s explicit, then it’s because you’re not explicitly shutting down. If it’s main window, it’s because you’ve not assigned the main window to Application.MainWindow.