Probably this question was already asked before, but my google-fu and SO-Search did not get me what what I was looking for.
I have a custom class, and a custom class comparer (for checking the equality of the class) implemented with IEqualityComparer.
public class Person
{
public string Name { get; set; }
public bool Fl...
When i declare
int[] a = { 1, 2 ,10,30};
int[] b = { 10, 20, 30 };
var q = from item1 in a
join item2 in b
on item1 equals item2
into g
select g
1)What is actually getting selected into g ? It is difficult to understand the into keyword. if you g...
How to modify version 2 to produce the same result as version 1,because in version 2 i am
getting cretesian product.
int[] a = { 1, 2, 3 };
string[] str = { "one", "two", "three" };
Version 1
var q =
a.Select((item, index) =>
new { itemA = item, itemB = str[index] }).ToArray();
version 2
var query = from i...
I am new to active directory and I am trying to put together a query that will return list of users and groups who have permissions to read the contents of any accessible file.
I can not find any samples that deal with files. So I am at a lost on how to start.
...
Given n enumerables of the same type that return distinct elements in ascending order, for example:
IEnumerable<char> s1 = "adhjlstxyz";
IEnumerable<char> s2 = "bdeijmnpsz";
IEnumerable<char> s3 = "dejlnopsvw";
I want to efficiently find all values that are elements of all enumerables:
IEnumerable<char> sx = Intersect(new[] { s1, s2,...
Will Linq work against any database (i.e) MySQL,Sybase,Oracle,DB2?
...
I have a method:
internal List<int> GetOldDoctorsIDs
{
var Result = from DataRow doctor in DoctorTable.Rows
where doctor.Age > 30
select doctor.ID
List<int> Doctors = new List<int>();
foreach (int id in Result)
{
//Register getting data
Database.LogAccess("GetOldDoctors...
I have a string array. What is the simplest way to check if all the elements of the array are numbers
string[] str = new string[] { "23", "25", "Ho" };
...
I have a linq query that is grouping by answers by QuestionGroup.
I need to have the table AssessmentQuestionsReference load so that i can bind to it in my WPF app.
var groupedAnswers = from a in App.ents.AssessmentAnswers.Include("AssessmentQuestions")
where a.Organisations.OrganisationID == App.selectedOrga...
Hello,
I am trying to update a table using LinQ. Though records are getting inserted, for some reason they are not getting updated.
what can be possible problem
Dim db as new empDataContext
Dim emptable as new employee
if update then
emptable=GetEmp(txtempID.Text)
emptable.Name="Test"
emptable.Age=11
emptable.City="NYC"
else
emptable...
I have an XML file :
<School>
<SchoolID>9</SchoolID>
<SchoolID>3</SchoolID>
<SchoolID>3</SchoolID>
<SchoolID>3</SchoolID>
<SchoolID>4</SchoolID>
<SchoolID>1</SchoolID>
<SchoolID>3</SchoolID>
<SchoolID>9</SchoolID>
<SchoolID>2</SchoolID>
</School>
The expecting results should be like:
<School>...
If I get two result IQueryable from different linq Query and I want to merge them together and return one as result, how to to this?
For example, if:
var q1 = (IQueryable<Person>).....;
var q2 = (IQueryable<Person>).....;
how to merge q1 and q2 together and get result like
var q = (IQueryable<Person>)q1.Union(q2);
...
I have this LINQ statement
Dim Demo = From d In DBDataTable.AsEnumerable _
Select id = d.Field(Of Integer)("id"), _
Colun = d.Field(Of Object) (_column2), _
Col3 = d.Field(Of Object)(_column3), _
Col4 = IIf(_Col4 <> -1, d.Field(Of Object)(_Col4), Nothing)
Is there any wa...
given the following code:
string[] colors = {"red","green","blue","red","green","blue"};
var distinctColors = (from c in colors select c).Distinct();
distinctColors.Dump();
Is it possible to fold the call .Distinct() into the embedded query syntax?
something like int T-SQL
select distinct color from TableofColors
...
Just I want to find any of the intColl of CustomerData is of single digit in length and select that customerData.
List<CustomerData> cdata = new List<CustomerData>();
cdata.Add(
new CustomerData { Key = 1, Name = "Marc",
intColl = new List<int>() { 1, 2, 3 }
}
...
Hi, this may be a dense question and I'm not finding it to be a dup of this one, but I need some help with understanding if an array can be used in a Select Case statement.
I have a sub routine that I will create a string array dynamically. The XML is also listed, but it could be any of the values listed below. It will be something like...
I need to replicate a T-SQL statement that has an inner select, using LINQ:
SELECT *,
CustomerTypes.Description as CustomerType,
(Select Min(Distinct DocumentStatistics.StatDateTime) As LastStatCheck
From DocumentStatistics
Where DocumentStatistics.CustomerId = Customers.CustomerId) As LastStatCheck
FROM Customers
INNER JOIN Custome...
select new FeedResource
{
Title = (string)details.Element("title"),
Host = (string)details.Element("link"),
Description = (string)details.Element("description"),
PublishedOn = (DateTime?)details.Element("pubDate"),
Generator = (string)details.Element("generator"),
Language = (string)details.Element("language")
...
Hello,
I have a gridview in asp.net page where I am allowing users to update data in the gridview with textboxes and dropdownlist.
When a user hits submit button I am trying to delete existing records and insert new records
When I try the below mentioned code it is throwing out errors. Right now I am not infront of the dev box thats th...
I am working on a ASP.NET MVC application where we have to write our own code for paging.
And I see elements getting repeated on different pages. This is happening because the order of elements in the Iquerable varies randomly and one have to query the database for each page.
I solved this problem by ordering the elements by date of cre...