Ok, so I have this nifty bit of code from Microsoft, and I have a little hiccup that I want to get rid of.
The original code prints out the ChangeConflictException x on the console, but I erased this line. Now, every time I use this bit of code, I get the error: "Variable 'x' is declared but never used".
What is the most efficient wa...
Hi All,
I'm getting an error when selecting from a rows.AsEnumerable(). I am using the following code...
var rows = ds.Tables[0].AsEnumerable();
trafficData = rows.Select(row => new tdDataDC
{
CalculationCount = row.Field<Int64>("biCalculationCountSeqID")
, Zone =...
Hi,
I'm having difficulty with my project and deploying it on my web hosting provider.
I'm on a shared hosting environment with "Host Level" trust.
I have used LINQ in my project but now they've just told me that Reflection is disabled on their shared services. I believe that reflection is required to be able to use variables within th...
I m reading data from a source as array. a[n]
I need to add one more element to the array.
Once i get the array, i create a new array with capacity n+1 and copy all the elements to the new array and put the new element as the last element of the array.
I can do this.
Is there a better way to do this? especially with Linq?
...
I need to delete a specific item from a dictonary..
The dictonary is like
dict["Key1"]="Value1"
dict["Key2"]="Value2"
dict["Key3"]="Value3"
dict["Key4"]="Value2"
How to delete the item if another item has the same value using LINQ
Thanks in advance
...
I'm looking to release a really simple application for windows Phone 7. Unfortunately, My Apps need to store some data in the device. say a Database.
My colleague found one SQLite library - http://sviluppomobile.blogspot.com/2010/03/sqlite-for-wp-7-series-proof-of-concept.html
But How about Linq to SQL or EF for Windows Phone 7. Any L...
Hi all..
Think the title describes my thoughts pretty well :)
I've seen a lot of people lately that swear to LINQ, and while I also believe it's awesome, I also think you shouldn't be confused about the fact that on most (all?) IEnumerable types, it's performance is not that great. Am I wrong in thinking this? Especially queries where ...
I have a stored procedure which returns all the fields of a table plus one, ie:
tablename.*,count(suchandsuch)
Of course, when executing this via LINQs ExecuteQuery I can get back instances of the table's class in an IEnumerable<>, but I also want the extra field which the stored proc tacks on.
Is this possible?
My current code look...
I'm experiencing some performance issues using linq, that led me to my first stackoverflow question:
The test function in the following code, is executed a differente number of times for these two linqs queries:
int[] mydata = { 1, 2, 34, 5, 67, 8 };
var query = from i in mydata select new { i,v=test(i)};
var query2 = query.Wh...
How to choose that which ORM would be feasible for a web Application? e.g if we are using Linq then why not nhibernate? and Which one is better and why
...
I have the following simple Linq query:
(from container in Container
join containerType in ContainerType on container.ContainerType equals containerType
where containerType.ContainerTypeID == 2
select container).Max (row => row.SerialNumber)
As is, this query works fine. The problem is that SerialNumber, in the DB, is an nvarchar type...
Please, help minimize the following code:
There is a class with dictionary property:
class Foo
{
public int Field { get; set; }
public Dictionary<int, bool> dic { get; set; }
}
And a list of Foo instances. I want to get united dictionary from all class instances like that:
...
var items = new List<Foo>
{
new Fo...
Do any one know how to return an anonymous type. I am using Linq where i need to return the following code
private <What's the return type to be provided here> SampleLinq(Int32 Num)
{
var query = (from dept in obj.DeptTable where dept.Id == Num select new { dept.DeptName, dept.DeptId });
return (query)
}...
The xml file is having the following structure
<Root>
<Child value="A"/>
<Child value="B"/>
<Child value="C"/>
<Child value="D"/>
<Child value="E"/>
</Root>
and the dictonary
Dictionary<int, string> dict = new Dictionary<int, string>();
i need to read the attribute value of "value" from the file and add t...
I'm still new to Linq so if you see something I really shouldn't be doing, please feel free to suggest a change.
I am working on a new system to allow officers to sign up for overtime. Part of the data is displayed on a map with search criteria filtering unwanted positions. In order to make the data easier to work with, it is read int...
I have the following xml:
<DOCUMENT>
<ARTICLE>
<META name="bbb" value="7086" score="0.58" key="6007"/>
<META name="ccc" value="7089" score="0.58" key="6008"/>
<META name="ddd" value="7087" score="0.58" key="6009"/>
</ARTICLE>
</DOCUMENT>
I need to use linq to xml and an xdocument to allow users in an asp.net page to edit ...
I want to use Linq to query a 2D array but visual studio c# 2010 express gives the message:
Could not find an implementation of the query pattern for source type 'SimpleGame.ILandscape[,]'. 'Select' not found. Are you missing a reference to 'System.Core.dll' or a using directive for 'System.Linq'?
var doors = from landscape in this.ma...
I have the following Linq query:
(from container in Container
join containerType in ContainerType on container.ContainerType equals containerType
where containerType.ContainerTypeID == someIDValue
select container).Max (row => Convert.ToInt64(row.SerialNumber))
This query works great as long as at least one Container row meets the cri...
string grid = @"08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08";
string[] res = grid.Split(' ');
var lowNums = from n in res
where n.Length > 0
select int.Parse(n);
I am having trouble converting the above linQ statement to a lambda WHERE equivalent.
The following works, but only returns am en...
Hi All,
I'm getting some Xml back from a service. I would like it to be the datasource of a grid view on my aspx page. Here is a sample of the Xml
<?xml version="1.0" encoding="utf-16" ?>
<ArrayOfTripTollCompleteDC xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<TripTollC...