.net-3.5

Missing graphics when disassembling and re-assembling .net program

I have a piece of software. When I disassemble the PE file ildasm foo.exe /output=foo.il I get a bunch of files, like foo.MainForm and foo.bar.dll. When I then try to re-assemble the file ilasm foo.il I get a working foo.exe back again, but some of the small graphics are missing in the new file (it's also ~200kb smaller). Some othe...

how do I determine where the user came from in asp.net?

How can I determine where a user came from when they land on my webpage. Did they come from a google link? Did they user a favorites link? Did they type in the url? ...

Converting an Object to Double?

What is the fastest way to convert an object to a double? I'm at a piece of code right now, which reads: var d = double.TryParse(o.ToString(), out d); // o is the Object... First thoughts were to rewrite this as var d = Convert.ToDouble(o); but would that actually be faster? EDIT: In addition to running the profile (by the way,...

C#, reading in Fixed Width records, varying record types in one file

To start I would like to clarify that I'm not extremely well versed in C#. In that, a project I'm doing working in C# using .Net 3.5 has me building a class to read from and export files that contain multiple fixed width formats based on the record type. There are currently 5 types of records indicated by the first character position i...

Enumerable LINQ extensions are hidden on strings... why and how ?

Possible Duplicate: Why doesnt VS 2008 display extension methods in Intellisense for String class Hi all. Yesterday I noticed that Enumerable LINQ exstensions are hidden on strings (I mean hidden from the intellisense). We all know string is an IEnumerable<char>, so automatically it should get Enumerable extensions, and actu...

WPF - Drawing a line of text with different background colors

I need to draw a line of text with that has a different background for part of the string (i.e. like a highlight) in WPF. The FomattedText class allows you to set various attributes for different parts of a string like bold, underline fore color etc but does not have background color. I think using TextFormatter and writing a custom Tex...

Emulating OwnerDraw controls in WPF

In the past, I developed a customized combo box in win forms which implements auto complete behavior where the matched portion of the text is highlighted in blue, whilst the rest of the string has the normal background color. In win forms this can be done fairly simply using OwerDraw mode. I need to do similar kinds of things for WPF con...

What's wrong with my code inner join in linq to sql?

What's wrong with my code? For the Employee table and the table Project are underlined in red ... Thanks in advance! DataContext db = new projfuncionarioDataContext(); var query = from p in db.Funcionario join c in db.Projeto on p.Cdfunc equals c.Cdfunc select new {...

LINQ method to group collection into subgroups with specified number of elements

Does there exist a LINQ method to group a given collection into subgroups with specified number of elements I mean, something like Scala's grouped method. e.g. in Scala, List(89, 67, 34, 11, 34).grouped(2) gives List(List(89, 67), List(34, 11), List(34)). In case such a method doesn't exist, what would be the LINQ way to do it? ...

Crystal Reports with SQL CE

I've been pulling my hair out trying to get some data to come across to my report. I first used the Microsoft Report viewer, but after trying Crystal Reports - I like the way Crystal Reporting is set up. The only problem is I can't get a single peice of data to come across from my sql ce DB. I've got a dataset I used as the datasource, ...

Using the WCF DataContractJsonSerializer in .NET 3.5

I'm trying to use the geocoding code from here in my ASP.NET MVC 2 site. Unfortunately, some of that code, specifically the DataContractJsonSerializer usage, is only possible through .NET 4.0. As my hosting provider doesn't support .NET 4, I'm forced to implement that functionality in .NET 3.5. How can I rework the code (which I have re...

System.accessviolationexception Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Hi All, I am getting following error System.accessviolationexception Attempted to read or write protected memory. This is often an indication that other memory is corrupt. when accessing a method of external dll. I have used this dll many other projects which also uses .net 3.5. This external dll uses method from another dll. All t...

Passing DataContext between windows in MVVM

On the main window onClick I have AddNoticeAboutWrongCity addNoticeAboutWrongCity = new AddNoticeAboutWrongCity(); addNoticeAboutWrongCity.DataContext = ((VerificationViewModule)this.DataContext).WrongCityNotice; addNoticeAboutWrongCity.ShowDialog(); At popup window there a lot of textboxes and two buttons Delete object: this.DataC...

On Creating Controls Dynamically or Not

Hi everyone I'm currently working on an ASP.NET 3.5 project, and I wanted to know your opinion regarding the following situation, which I happen to run into sometimes: Let's say I've defined the following control of an imaginary component framework somewhere in my code: <Window runat="server" ID="windowTest" /> Let's assume that wit...

Linq to Entities - eager loading using Include()

Hey Everyone, I've got this really basic table structure: dbo.tblCategory dbo.tblQuestion (many to one relationship to tblCategory) dbo.tblAnswer (many to one relationship to tblQuestion) So basically, what I'm trying to do is when I load a category, I want to also load all Questions, and all Answers. Now, I've been able to do this...

When to use and when not to use Try Catch Finally

I am creating asp.net web apps in .net 3.5 and I wanted to know when to use and when not to use Try Catch Finally blocks? In particular, a majority of my try catch's are wrapped around executing stored procs and populating textfields or gridviews? Would you use Try Catch EVERYTIME when you execute a stored proc and populated a data displ...

Warnings in edmx file when upgrading from 3.5 to 4

Hello I updated my solution from .NET 3.5 to 4.0, and thanks god, I just had to fix minor things. But what I don't understand is, the edmx file generated many warnings like this: Error 2005: Mapping Association 'FK_CP_C' is redundant: Its referential integrity constraint provides sufficient information. You can safely delete the mappin...

.NET 3.5 runtime and .NET 4 runtime compatibility

Is it possible to run an application built on .NET 3.5 with a plug-in built with .NET 4? Cheers, Christian ...

How to read from Named Pipe latest data for a while and save that data to disc using C#?

So I have some server broadcasting live data onto Named Pipe - \\.\pipe\TestChannel (from VLC for example). I want to read it from now some N seconds and save that readen data to some.file. How to do such thing using C# .Net3.5? (and BTW I wonder about if it is easier to do it from .net4) Could you please provide some simple code exampl...

Code contracts for .NET 3.5 messes up VS10's debugger

I've recently migrated a lot of manual precondition testing and exception throwing with code contracts. Instead of upgrading to .NET 4, I've been using the Microsoft.Contracts.dll assembly so I could stick to .NET 3.5 a bit longer (this is a library that is used both by .NET 3.5 and .NET 4 assemblies). I've set up the contracts rewriter ...