.net-3.5

.NET List.Distinct

I'm using .NET 3.5. Why am I still be getting: does not contain a definition for 'Distinct' with this code: using System.Collections.Generic; //.. . . . . code List<string> Words = new List<string>(); // many strings added here . . . Words = Words.Distinct().ToList(); ...

c#: a method to count occurrences in a list

Is there a simple way to count the number of occurences of all elements of a list into that same list in C#? Something like this: using System; using System.IO; using System.Text.RegularExpressions; using System.Collections.Generic; using System.Linq; string Occur; List<string> Words = new List<string>(); List<string> Occurrences = new...

Type.IsSubclassOf does not behave as expected

I have an application that loads assemblies and looks for types that are subclasses of a class C1 defined in another assembly A1 that the application references. I've defined a type T in A1 that is a subclass of C1 but when I load A1 using Assembly.Load(...) then call t.IsSubclassOf(typeof(C1)) on an instance of T I get false. I've notic...

Inserting Variable into Inline XML in VS2008

so i have some inline XML Dim x As XElement = _ <parent> <child></child> </parent> what I want to do is get some variables that have been set into that xml Dim v as string = "Blah" Dim x As XElement = _ <parent> <child>{v}</child> </parent> Is this possible? I...

Fastest way to store a Large Set of Data (C# ASP.net)

A webservice i'm working with sends back a result set that equates to around 66980 lines of XML, .net returns this as a list object. As the user journey requires that we can reload this set if they step back a page, whats the fastest/best way of storing this result set per-user without slowing everything down. Ta -- many solutions: ht...

C# cannot implicitly convert type T to type T

my method: public TableFilled<TKey, TRow> getTera() { Func<TablesFilled<TKey,TRow>> _getTera=new Func<TablesFilled<TKey,TRow>>( ()=>{return (TablesFilled<TKey,TRow>) chGetTera();}); //Above does not compile says: Cannot convert type //'AcapsVerify.FunctionalTables.TableFilled<TKey,TRow>' to //'AcapsVerify.F...

RhinoMock 3.5 Runtime error when running on .net

I'm using Rhino Mock 3.5 for .Net Framework 2.0 and when I run this code I get a run time error. This is the code IFile fileInterface = MockRepository.GenerateStub<IFile>();<br> IUrlMapper urlMapper = MockRepository.GenerateStub<IUrlMapper>(); // this is the line causing the run-time error<br> HttpContextBase mockHttpContext = MockRe...

How can I retain update bindings while showing additional information?

I'd like to display a linq-to-sql on a datagridview as such: Dim myQ = From b In _dcBooks.Books Select New With {Key b.ID, b.Title, b.Genre, b.ISBN, b.Format, b.Series, _ .Author =b.BooksAuthors.Count()} the formula for the authors column is simplified as it would normally display nothing, the only author or "multiple". ...

Is there a quick way to say If notempty x = y else x = default in a Linq where query

Is there a quick way to say Where (data.x == (If notempty x = y else x = default)) Assuming the data being compared is both strings Compare listitem.string with passed.string - if passed.string isnotempty, else passed.string equals default value. in a Linq 'where` query. Apologies that the question was really badly written. ... ...

Routing Rule for ASP.NET Products Website

I am building a product catalog for a customer website under ASP.NET using .NET Framework 3.5 SP1. Each product has a part number and an OEM part number (all globally unique). For SEO purposes I would like the OEM part number to be as close as possible to the actual domain name. How do I build a routing rule that allows me to do this:...

Can't test with NUnit on Vista 64bit

Hello, I encountered the problem while trying to run unit testing with NUnit 2.5 in Vista 64bit, MS Visual Studio 2008 SP1, Projects framework 3.5. I have 2 projects in solution, the first - main project and the second - project with tests. Both projects targeted "Any CPU" platform. In fact, I didn't changed anything concerning platform...

What files to be included under VSS 6.0

For our .net 3.5 web project, what are the files which needs to be included under VSS 6.0? We have a distributed team of three vendors working on separate modules of our .net portal and all of them maintain their own setup and during release they send across the final build. No surprises that this has caused much headache and we have dec...

Xaml do not load UserControl from ViewModel object?

I have a Xaml code that should load my UserControl inside the TabControl. If I put this Xaml code: <DataTemplate x:Key="WorkspacesTemplate"> <TabControl IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding Path=Gui}" ItemTemplate="{StaticResource ClosableTabItemTemplate}" Margin="4" /> </DataTemplate> I have absol...

Creating Campaign in MicrosoftAdCenter Using API 6.0 and ASP.NET C#

I am working In dotNet Framework 3.5 ASP.NET C#. I want to create Campaign in Microsoft AdCenter API Version 6.0. For that I reffered the website 'http://msdn.microsoft.com/en-us/library/bb671919.aspx'. I created the same example with different Campaign Name (because campaign name is unique). But I got the error message 'Invalid client d...

How to do If statement in Linq Query

I currently have a list that contains the following CountryCode (string) CountryStr (string) RegionStr (string) RegionID (int) AreaStr (string) AreaID (int) This is a flattened set of linked data (so basically the results of a joined search that ive stored) The MVC route will only pass one string which I then need to m...

Howto load assemby at runtime before AssemblyResolve event?

Actually i tried to implement some kind of 'statically linked' assemblies, within my solution. So i tried the following: Adding a reference to my assembly with CopyLocal = false Adding the .dll file itself to my solution with 'Add as link' Adding the .dll file itself to my resources with 'Add Resource' - 'Add Existing File' Adding some...

What's the linq version of a multiple field group by count?

SQL query: select ApplicationNumber,pri_indicator,count(*) from customer group by ApplicationNumber,pri_indicator How do I do this in LINQ? I see plenty of results on using a simple group by to count a single field, but can't seem to find any or figure out how to do multiple fields. ...

SharePoint 2007 and Detecting .Net 3.5

I have seen in this TechNet article where SharePoint supports .NET 3.5. I've looked to see if SharePoint requires .NET 3.5 and it appears that it only requires .NET 3.0, even with SP1 or SP2. Can anyone confirm that SharePoint only requires .NET 3.0 regardless of what service pack you have? Also, is there a recommended approach for de...

Decrypting with private key from .pem file in c# with .NET crypto library

I know this is a similar question to this one but before I head down the Bouncey Castle route, does anyone know if its possible to load an RSA KeyPair from a .pem file (-----BEGIN RSA PRIVATE KEY-----) directly with the .NET 3.5 crypto library without having to go to a 3rd party or roll my own? ...

Global.asax's Application_BeginRequest is not being hit

I have a Website that is using .NET 1.1 app pool and then I also have a Virtual Directory within that website that is .NET 3.5. This Virtual Directory's contents are built with Visual Studio 2008 as a separate project. When testing, everything works fine and all Global.asax events are hit and the app goes through the execution pipe lin...