.net

NotSupportedExceptions thrown everywhere when debugging in windows CE.

I am doing some work on a windows CE 6.0 application. The application loads a number of external assemblies dynamically using. Assembly assembly = Assembly.Load(path); These .dll files are outside of the solution, but there are classes in each of them that implement a common interface. Once the assemblies are loaded the application l...

Constructing a (somewhat) complex object

When I create classes, simple constructors tend to be the norm. On one of my current projects, a movie library, I have a Movie domain object. It has a number of properties, resulting in a constructor as follows: public Movie(string title, int year, Genre genre, int length, IEnumerable<string> actors) { _title = title; _year = ye...

Select a model property using a lambda and not a string property name.

I'm building a list of properties of a type to include in an export of a collection of that type. I'd like to do this without using strings for property names. Only certain properties of the type are to be included in the list. I'd like to do something like: exportPropertyList<JobCard>.Add(jc => jc.CompletionDate, "Date of Completion...

An ungreedy regular expression to fetch title from a page

Hello I want to get the title of a web page using C#. So i'm requesting that page and getting the response page and using a regular expression to extract the title. string regex = @"(?<=)([\s\S]*)(?=)/"; But i saw a site having two titles such as <title>Page Title</title> <link href="...."/> <title>Page Title</title> So when i use ...

Create a union of the members of anonymous types.

How could it be possible to union the members of instances of two or more anonymous (or maybe not anonymous) types, to create a resulting type instance with all the members? Pseudocode example: var anon1 = new {FirstName = "Bill"}; var anon2 = new {Surname = "Hicks"}; var anon3 = anon1.Union(anon2); Debug.WriteLine(anon3.FirstName + "...

Retrieve data from LinqDataSource before Skip and Take happen?

Hello, I have a GridView that uses LinqDataSource. The GridView has default paging enable. I would like to retrieve the data from LinqDataSource before the paging takes place so that I could calculate the Sum of one single column of the whole database using Linq2SQL. Right now, I'm using LinqDataSource_Selected event with LinqDataSourc...

.NET WCF: Proxy lifecycle management with DuplexChannelFactory

I'm a little unclear on what the proper way is to use DuplexChannelFactory in WCF. Following from convention, I have explicit Connect/Disconnect methods on my service contract to aid in management of the proxies, but I'm a little unclear as to what the client should be doing. Here's my impression of how things work. When initiating the ...

What is the difference between an "Application Configuration File" & "Settings File" in C#?

What is the purpose of having two files that appear to do the same/similar thing? Is one deprecated and should I be using the other? Please, break it down for me. Thanks! ...

Is there a .NET or Win32 version of regsvr32?

Is there a .NET or Win32 version of regsvr32? I would like to register a COM DLL with code instead of shelling out to the regsvr32 program. ...

.NET Choose Items Dialog

Is there a standard .NET control for what I call "a two pane picker", or do I have to code it by hand? Two pane picker: The left pane has a list of items. The user can pick items from the left pane to put them in the right pane using buttons between the two panes. Picked items in the right pane can be reordered with buttons. An exam...

Many-To-Many relation through non-primary key for legacy system

I have a legacy system I'm working on and there is a particular relationship I'm having trouble with. The issue is that I need to relate Patient to HL7EPICareMeds... the relationship above isn't working, of course. From the table perspective, here is what I have Patient: PatientId : int, PK ClinicPatientId : varchar --- not unique ...

JQuery WCF .net 4 Rest 405 Method Not Allowed Trivial

I keep getting a 405 Method not allowed. The script is hosted on same port as server, using IIS. <script> function auth() { var str= '{"Password":"Password","Username":"Username"}'; $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "http://127.0.0.1:8080/auth/authenticate", data: s...

Separating Records into indvidual months for mvc

so i have a collection of records. Which have two boxers, match date, location etc... I want to separate them by months and group them together. Currently I have what is below. And it works to a degree. That looks for matchdates in the future. that is this year and steps through each month (1-12) and finds any matches in that date range...

TreeListView performance with large collections

I'm using a FastObjectListView to show the results of a search which may return a large number of results. Now I'd like to allow results from this list to be expanded in to a tree. Am I going to have any performance problems using a TreeListView over a FastObjectListView? I know TreeListView inherits from VirtualObjectListView, so it i...

How can I XML Serialize a Sealed Class with No Parameterless Constructor?

I'm currently using an XMLSerializer to serialize a list of a class of my own. One of the class's properties is an instance of a sealed class that does not have a parameterless constructor, so the XML Serializer refuses to serialize the class. How can I get around this? I need that property to be serialized. Is there some way for me ...

What is the size of a Nullable<Int32>?

So, a couple of questions, actually: An int (Int32) is specified to be (obviously) 32 bits. What about an int? (Nullable<int>)? My gut tells me that it would be 32 bits for the integer plus 8 more bits for the boolean, but perhaps the implementation is more intricate than that. I would have answered my own question using sizeof(int?); ...

How to release all the resources of a class when I have done with it

How can I call a GC in .net when I have done with the object that i created for a class. If I sets an object value as Null objClassObject=NULL; Does it releases all the objects and resources associated with it. ? ...

List, IList, IEnumerable, IQueryable, ICollection, which is most flexible return type?

I've seen this question posted here previously but I'm not satisfied that I understand the complete ramifications. The problem is what return type should a data layer that uses linq-to-sql return for maximum flexibility and query ability. This is what I've read/found: IEnumerable is limited and only allows for read forward operation. I...

is a garbage collector (.net/java) a problem for real-time systems?

When building a system which needs to respond very consistently and fast, is having a garbage collector a potential problem? I remember horror stories from years ago where the typical example always was an action game where your character would stop for a few seconds in mid-jump, when the garbage collector would do it's cleanup. We are...

How to bound 2 variables in C++ one with other so when one changes changes another?

How to bound 2 variables in C++ one with other so when one changes changes another? for example I created Int A and Int B bound one to another and than when I change A one using some function another one will automatically change to new value of A. I am intrested in version for C++ .net 4th version. ...