Linq: additional parameter

I have the following line: orderBaseData.Single(o => o.Id == order.Id).OrderMessages.Count; I want to filter this a bit more. Each OrderMessage has a variable called hideFromUser, and I want to get the count of the OrderMessages where this is set to

How to load assemblies in ASP.NET Core 1.0 RC2

migrating my web app from ASP.NET Core RC1 to RC2. I'm trying to load my referenced class libraries. This code snippet doesn't work with RC2 anymore. public class Startup { public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILogg

Scroll to the first item in the list in the view

I maintain a legacy application and have a request to add a feature.I have a listbox showing some items. When the Itemssource is changed, I want the listbox to scroll to the top. To do this I have subscriped to the event: private bool handlerAdded =

Running a Crystal Report directly in PDF format in C #

I have a single Crystal Report that I am trying to run via a web site using a Report Viewer and also (using the same .rpt) via a background process that would generate the report straight to a stream or file using the export options. I am not using a

Strange error while analyzing the channel so far?

When I try to parse date like this: DateTime t1 = DateTime.ParseExact("August 11, 2013, 11:00:00 PM", "MMMM dd, yyyy, hh:mm:ss tt", System.Globalization.CultureInfo.InvariantCulture); It works correctly but when I do thing like this :

Format the time value

I want to format a ms value to a "minutes:seconds" value of two digits, by two digits I mean "00:00" but what I get is "0:0". This is an example: I want to show "02:04" instead "2:4" This is my code: Label

regex to ignore braces

{unknown string} {unknown string unknown string} unknown string How do I come up with a regex that recognizes just the string (which is unknown, so I cannot do an explicit match to a specific string) in all four of the above cases?You haven't tried m

How to change the pixel color of an image in C # .NET

I am working with Images in Java, I have designed more over 100+ images(.png) format, They were all Trasparent and Black Color Drawing. The problem is, Now I have been asked to change the color of the Drawing (Black -to ). I have searched many code s

Managing child form collections

In case my ViewModel has some child property: public class MyViewModel { public MyFormViewModel Form {get;set;} } and I render a form for this property, I can then have the following ActionResult: [HttpPost] public ActionResult SomeAction(MyFormViewM

List of elements implementing INotifyPropertyChanged

What is the best way to implement collection of items, where: each item could be of different type each item will raise PropertyChanged event on its change (parent class implements INotifyPropertyChanged) Update: I'm thinking on something like this:

Pass long strings (as argument) in a console application

I'm creating a console application in C# to which, at execution, it is passed a bunch of data. Three of them are short strings, such as username, password, etc. However, one of them is a rather lengthy XML document. How long can the strings be, when

Examples of metaprogramming in F #

I'm interested in metaprogramming examples written in F# that demonstrate the use of F#-specific functionality such as the TryGetReflectedDefinition function in the F# standard library. Where might I find such examples?WebSharper and Unquote are two

add programmatically add items from the resource dictionary

I'm just new in wpf and am planning to use a listbox to generate recently opened or closed items. Everytime a file is opened, it gets added permanently added into a resource dictionary of type listbox item. On the other hand, besides the listbox item

Add a txt file in .Net

I am Creating a txt file in.Net with the help of below code. StreamWriter writerVer = new StreamWriter(@"c:\Version.txt"); writerVer.WriteLine("Version : " + Context.Parameters["ver"]); File.SetAttributes(@"C:\Version.tx

Intelligencia UrlRewriter with RegEx does not work

I have the following rewrite rule: <rewrite url="^/Membership/(.+)/(.+)/(.+)/(.+)" to="/Membership/Index.aspx?parentf=$3&f=$4"/> which I am expecting should work with this URL: /Membership/Benefits/Member-Groups/Sub-Groups/Mo

Are DataContract Attributes Required for WCF

I'm writing WCF service and his client. I want to send/receive objects of my custom classes, between service and client. I have 3 modules WCF service WCF client common class library Both WCF service and client have references to common class library.

Is there a .Net Statistics library with T-Tests and p-values?

Does anybody know of any good and free statistics libraries for .Net? I am working on calculating T-Tests, which I have written a formula to calculate, although now I need a formula for the p-value, which is a little more complex, and not being a sta

Merge the derived class to the base

Class A { } Class B : A { } B ItemB = new B(); A ItemA = (A)B; Console.WriteLine(ItemA.GetType().FullName); Is it possible to do something like above and have the compiler print out type A instead of type B. Basically, is it possible to permanently c

Compile .NET code in .NET 4?

I remember when .NET 4 was in beta there was a video of a developer that made a command-line app that he could type C# code into and it would compile the code on the fly. The idea was that the compiler was now available in the .NET language. Anyone r

Silverlight xap file hosting, single blank screen displayed

I have a SL 3.0 xap I want to host in a ASP.NET website, I have access to the XAP file and I have created a HTML page to host the SL component. When I access the page all I see is a white screen where the SL component should be, SL is loaded but the

Business Components: When to Introduce Them

I am performing a code review (VS2008/.NET 3.5). The development team has created several data access components in a DAC assembly. I encountered a business proces assembly where every DAC is wrapped with a business component with no additional value