You're stuck with targeting .NET 2.0 in Visual Studio 2008, but you'd like to use all the latest goodness from .NET 3.x features, like:
LINQ
Extension Methods
Lambdas
What can one do to enable this awesomeness?
EDIT: I had not originally found the post: http://stackoverflow.com/questions/173080/c-net-3-0-3-5-features-in-2-0-using-v...
I am having a hard time solving this problem, need code for creating a dynamic linq query in C#, asp.net. I have 5 dropdown list that searches different column in same database table and return item filtered value to a single listbox. The problem is there is no sequence that which or all or any wil be selected in DDLs but the combined...
I have a Dictionary<int, string> which I want to take the Key collection into a CSV string.
I planned to do:
String.Join(",", myDic.Keys.ToArray().Cast<string[]>());
The cast is failing though.
Thanks
...
Main problem: how do i group elements by their Date, only if continuous and only if they match some properties?
Details:
Given this type of object:
public class MyObj
{
public DateTime Date { get; set; }
public string ConditionalValue1 { get; set; }
public int ConditionalValue2 { get; set; }
public int OtherValue { g...
Given the following XML example we could imagine a schema defining Root as containing a sequence of unbound number of choices between Type1 and Type2.
<Root>
<Type1 />
<Type2 />
<Type2 />
<Type1 />
</Root>
I am testing out migrating from the XSD.exe tool which although adds type-safety has a lot of little annoyances. ...
I have somewhere around 20 tables that I am working with. I can update the User table just fine, however, when I try to update my Adress table, nothing happens. I dont receive an exeption and the method looks like it executes ok but when i check my data, the values are still the same.
Im thinking that it has to do with the fact that i m...
I'm using the query below:
public IEnumerable<QUESTIONARIO_BASE> ListQuestionario()
{
var query = (from c in _entities.QUESTIONARIO_BASESet
.Include("QUESTAO_BASE")
.Include("QUESTAO_BASE.DIMENSAO")
.Include("QUESTAO_BASE.RESPOSTA_BASE")
...
I have this method, that will be called against from a WCF Client, but for my testing, I'm uisng a local "add project reference." I'm getting the error that I cannot call the DataContext after it's disposed.
public IEnumerable<Server> GetServers()
{
// initialze to null
ServersDataContext sdc = null;
try...
I've been looking around and I was wondering if this is available in VS10 beta2.
So far all I've seen is the Linq to XSD alpha 0.2 preview that works for VS 2008
...
I am trying to use LINQ to XML in an with the XDocument object. How do you query the result element in the example below?
<serv:header>
<serv:response>
<serv:result>SUCCESS</serv:result>
<serv:gsbStatus>PRIMARY</serv:gsbStatus>
</serv:response>
</serv:header>
When I use a statement like this, I get the exception 'Ad...
I have these two classes
public class Person
{
}
public class Company
{
public List<Person> Persons
{get;set;}
}
Challenge: Given a list of Company (i.e., List<Company> Companies). Create a dictionary with the key Person, and a list of Company he belongs to as the values. Note that one Person can belong to multiple Companies.
I am o...
I have two tables with the following layout and relationships:
Tasks:
TaskID StartTime EndTime TaskTypeID ProductionID
------------------------------------------------------------
1 12:30 14:30 1 1
2 14:30 15:30 2 1
3 11:10 13:40 2 ...
How do I go about passing two sets of Data to a view in ASP.NET MVC?
I've tried a couple of things and neither have worked so I've come to the simple conclusion: I'm doing it wrong.
I have 2 queries:
callRepository.FindOpenCalls() and callRepository.FindAllMyCalls(user)
and I want to out put both sets of data to one view via 2 partia...
Hello,
Is there a way to get the code below to return null if no objects are found?
var news = (from c in childs
where c.Name.ToLower().Contains("folder")
select c).First();
...
I have the following xml
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
<entry><id><![CDATA[text]]></id><
author><name><![CDATA[film24]]></name></author><title><![CDATA[text]]></title>
<updated>2009-10-30T15:55:13+00:00</updated><published>2009-10-30T0...
I am getting error msg on the word Records - Type or namespace could not be found. Please help debugging it, what is missing?
if (ProjDDL1.SelectedItem.Value != "--") results = CustomSearch<Records>(results, s => s.Business == ProjDDL1.SelectedItem.Value);
Method CustomSearch:
private DataTable CustomSearch<TKEY>(DataTable dt, Fun...
I have zero knowledge, but I can't find a hello world program for using linq to read a database table, can anybody write a hello world and working program for me?
Thank you!
...
Ok I now have this
public IEnumerable<roomvu_User> GetLocationUsers(
long LocationID,
DateTime StartDate,
DateTime EndDate,
int StartRows,
int MaximumRows)
{
using ( DataClasses_RoomViewDataContext context = Context )
{
IEnumerable<roomvu_LocationMapping> Mappings =
( from m in context.ro...
I have two collections of my own reference-type objects that I wrote my own IEquatable.Equals method for, and I want to be able to use LINQ methods on them.
So,
List<CandyType> candy = dataSource.GetListOfCandy();
List<CandyType> lollyPops = dataSource.GetListOfLollyPops();
var candyOtherThanLollyPops = candy.Except( lollyPops );
Acc...
Hi there,
I have the following expression in linq (its a join) and i am selecting into "J" because i need to use J later (currently i just selecting J but once i have this fixed i plan on use J within another subquery after)
But it won't let me supply a where using the "V" side hence v.IdOFfice is invalid.
I have tried swapping around ...