LINQ Back To The Same Object?

Mar 1, 2010

how to convert a linq query directly back to the same object type. But I have failed!

Dim test(2) As myStructures.ReturnData
test(0).Partnumber = "2055"
Dim result = From n In test _
Where n.Partnumber = "2055"

'now convert result to a myStrucutres.ReturnData() how?

View 3 Replies


ADVERTISEMENT

Object Collision - An Object Bounce Back When It Collides With An Rectangle Shape?

Mar 21, 2012

how I could have an object bounce back when it collides with an rectangle shape. There are multiple rectangle shapes and I don't want to do it all seperately for each one.

View 1 Replies

When Calling New On An Object - Can The Object Being Created Refer Back To Its Caller

Nov 11, 2010

I hope the question makes sense, anyways. I'm looking to know if in VB.NET, when we call an object's constructor, is there some kind of a reference that points back to the caller? I'm interested because of a corner case where I want the object being created to first be able to validate the existence of some data in the caller before it allows itself to be created. If this validation fails, I plan on throwing an exception. This corner case will never happen at runtime unless the object being created is used improperly by a programmer. The object being created is not inheriting the object I want it to validate, so I can't do anything with the MyBase qualifier.

It's bit of a "future-proofing" issue that I have a (bad) habit of doing. Not critical -- I can always leave stern comments behind as a last resort. Wanted to know if this was possible.

View 3 Replies

Asp.net Mvc - Why Can't Get Anything Back When Use Linq To Sql Select

Feb 3, 2011

Why can't I get any values back when I use Linq to Sql? BHS_TimeSheet is my database table in which have some records. Model.TimeSheet is a class I create in the model. Private db As DataFactoryDataContext

[Code]...

View 1 Replies

Error - LINQ To Entities Does Not Recognize The Method 'System.Object IIf(Boolean, System.Object, System.Object)'

Jul 29, 2011

I am getting following error whenever I want to use IIf function inside entity framework query.

LINQ to Entities does not recognize the method 'System.Object IIf(Boolean, System.Object, System.Object)' method, and this method cannot be translated into a store expression.

View 1 Replies

Convert An Object System.Data.Linq.DataQuery To System.Linq.IQueryable?

Oct 21, 2009

How can I convert an object of type System.Data.Linq.DataQuery to System.Linq.IQueryable?I'm working with Visual Basic/Silverlight, and the source code of my query is as follows:

Public Function Get_Cli_Pag() As IQueryable(Of V_Cliente_Pagare)
Dim Qry = From P In Me.Context.Pagares Join C In Me.Context.Codigos On C.Codigo

[code]....

View 1 Replies

Asp.net - Read Back An Object Stored In A Session?

Jun 2, 2010

Structure MainStruct
Dim Ans1 As String
Dim Ans2 As String
End Structure

[code]....

The question is how can i read back the contents of the list, stored in the Session?I mean something like...

Build = Session("MyData")

View 2 Replies

Back To Previous Page Loses Request Object?

Jun 21, 2012

I have a need for a button to take the user back to their previous page.Because of how this page is accessed, the only way to do this is with javascript using history.back()

This part works perfectly apart from the fact when a user goes to click a button on the page they have gone to back to, I get the error that Request.QueryString is not supported in this context.I'm guessing the Request object is lost when javascript is directing the user to the previous page.I cannot use Request.UrlReffer either because the the nature of the back button. (it causes a loop at times).

View 2 Replies

VS 2005 Variant - Values Coming Back From The Function Is Not Getting Converted To Object Type Properly

Jun 8, 2011

I have some ActiveX that was written for VB6. They all seem to return Variant types. Ex.

[Code]....

In this case the GetPosition control is returning a robot axis position. It looks to me like the values coming back from the function is not getting converted to object type properly.

View 2 Replies

How To Get Data From A LINQ To SQL Object

Jan 27, 2012

I have the following line of Dim clients = From client In db.clients Select client Where client.ClientID = id

In debugging, the clients object populates perfectly, but how can get get data from the clients object? Like if the clients object has a FirstName property, how can I set a textboxes text property to that property from the clients object?

I thought it'd be something like:

tbClientFirstName.Text = clients.FirstName But that doesn't work.

View 2 Replies

.net - Generate Complex Object From LINQ To XML In .NET?

Apr 1, 2009

I have an XML File that I am processing using LINQ. I want to basically serialize the XML data into custom objects but don't know how.

[Code]...

How can I finish the above LINQ query to populate the Children property of the Group object?

View 2 Replies

.net - Linq To Object - Select Distinct

Mar 18, 2010

I can't quite figure out why this Linq Statement isn't working as i would expect:

[Code]....

I would assume that this would create a new collection of anonymous types, that would be distinct. Instead it creates a collection the size of the "ThisParentCollection" with duplicate "MyAnonymousType" in it (duplicate id's).

View 1 Replies

C# - Linq Select Certain Properties Into Another Object?

May 28, 2009

So say I have a collection of Bloops

Class Bloop
Public FirstName
Public LastName

[Code]....

Is it possible using Linq to select the FirstName and LastName out of all the Bloops in the collection of Bloops and return a collection of Razzies? Or am i limited to a For-Loop to do my work?

To clear up any confusion, either VB or C# will do. Also this will probably lead to me asking the question of (What about using a "Where" clause).

View 4 Replies

Deserialize JSON To LINQ Object?

Mar 24, 2011

In VB.Net class, I have a JSON data as string. I want to convert them to LINQ class Object.[code]....

View 2 Replies

How To Write This Into Linq To Object Query

Feb 24, 2010

from a list, which got 3 attributesI want to return a new list of that class where attribut1 recurrence in the list equals Xfor an example this;

1,a,b
1,c,d
1,e,f

[code]....

View 3 Replies

Linq - Filtering List Object?

Apr 13, 2011

I am using LINQ - VB.Net I want to filter my List object by passing String object in the where.

Dim _permittedTransactionCodes As List(Of String) = Nothing 'String object

it is populated with data.

Dim tap100transCodeInfos As List(Of Tap100transCodeInfo) = _dal.GetActiveTap100transCodeByHdrScreenCde(UCase(screenId), "TRAN_CDE")

i am trying something below, but not getting the filtered results

tap100transCodeInfos.Where(Function(x) _permittedTransactionCodes.Contains(x.TranCde))

View 1 Replies

Linq To Object - Method Not Found?

Nov 11, 2010

I am trying to use a simple LINQ to Objects query.When I try to run my application I get the message:

System.InvalidOperationException was unhandled Message="An error occurred creating the form. See Exception.InnerException for details. The error is: Method not found: 'Void sharatTashlumimWS.paymentDetailsManager.set_ReleaseDate(System.DateTime)'."
Source="WindowsApplication1"
StackTrace:

[Code]...

View 2 Replies

Using Linq For Object Dataset Processing?

May 26, 2011

I have a collection (IList(Of Sample)) of the following class:

Public Class Sample
Public sampleNum As String
Public volume As Integer[code].....

This collection is filled from a regex that gets passed over a file.What I want to do is use Linq to generate a collection of these for each unique samplenum using the following conditions.For each samplenum: Have the highest volume where the final is greater then one

If the sample has multiple records for this volume then pick the one with the the highest final

If the previous step leaves us with no records pick the record with the highest final ignoring volume

I am extremely new to Linq and just can't get my head around this. For now I have solved this using for each's and temporary lists but I am interested in how this would be handled using pure Linq.Sample Data:

samplenum | volume | initial | final
1 | 50 | 8.47 | 6.87
1 | 300 | 8.93 | 3.15[code]......

View 2 Replies

Vb.net - Sorting A List Of <Object> With VB And LINQ

Mar 1, 2012

I'm trying out some LINQ expressions and can't get them to work with the List class. Basically I want to be able to sort a list of custom objects by property type, however the C# LINQ syntax is KILLING me and I can't figure out how to convert it to VB

Class Foo
Sub New(Name As String, Position As Integer)
Me.Name = Name

[code]....

View 2 Replies

C# - Generics And Linq - Create The Object Of XPQuery ?

Feb 6, 2012

I have got the list of Class Name as Follows: Type[] typelist = typeof(Sample.Students).Assembly.GetTypes();

Now i have complete list of all classes available in Sample NameSpace:

Now i want to get data through class I am using Devexpress Persistance class so basically i have to create XPQuert Object as follows: XPQuery<Employee> EmployeeQuery = new XPQuery<Employees>(XPODefault.Session);

But in my case Employee class will be listed in typelist variable..How can i create the object of XPQuery.. is it possible something like this: XPQuery<typeof(typelist[0].Name)> EMployeeQuery = new XPQuery<typeof(typelist.Name)> (XPODefault.Session);

I meant i want to create object dynamically.

View 2 Replies

C# - LINQ Query On Object With Unknown Class

May 13, 2011

I have an array of unknown (to the current method) class objects. I do know that each class has a property called "Number". I am trying to write a LINQ query where I am looking for the object with the next Number in sequence. AKA, I'm at Number 8, use a LINQ query to find the object where Number=9.

View 5 Replies

Check Whether A Linq-to-SQL Object Is Already Attached To A DataContext?

Jun 27, 2011

I have an object that may have been inflated via a plain old DataContext, or may just have been new-ed up with just its .ID property set. There's no way to know for sure. I'm looking to rehydrate the entire object from whatever is in the database. If the object was new-ed up, I can call .Attach() on the table object and refresh from the Data Context with no trouble. But, if the object was already inflated from the DataContext I get the error: "Cannot attach an entity that already exists.". There's no timestamp field or anything like that - just an integer primary key being used to control the rehydration. I'd like to know if there's a way to conditionally attach. Here's the code - it works the way I want it to, but this seems a hackish way to go about it:

' myDC is a shared instance of a vanilla DataContext...
' myObj is an instance of a linqed-up `SomeLinqObject`
Dim tbl = myDC.GetTable(Of SomeLinqObject)()

[Code[,,,,,

View 1 Replies

Group By Over Anonymous Type With Linq To Object?

Feb 25, 2010

I'm trying to write a linq to object query in vb.net, here is the c# version of what I'm trying to achieve (I'm running this in linqpad):

void Main()
{
var items = GetArray(

[code].....

View 1 Replies

LINQ And Option Strict When Using Custom Object?

Aug 12, 2011

http://127.0.0.1:47873/help/1-6644/ms.help?method=page&id=C318B79A-FA4D-4DE3-B62D-C1162BEB267E&product=VS&productVersion=100&topicVersion=100&locale=EN-US&topicLocale=EN-US
and i get the following error

[code].....

View 3 Replies

LINQ To Objects, Query Arrays In Object?

Sep 15, 2011

I need to query an array. I have tried to use LINQ but with no success.

Here is a simplified structure of Insurance

Public Class Insurance
Public _typ As String
Public _numb As Number()

[Code]....

View 1 Replies

Select A Single Object Using Linq In Program?

Mar 18, 2011

I have done a lot of searching to what appears to be a simple LINQ problem but I can't figure out how to do grab an object out of a collection that has a specified minimum (or max value) without resorting to a sort like this[code]...

View 3 Replies

Update An Object's Foreign Key Value With LINQ To Entities

May 4, 2012

[code]How do I update the ProdServiceID in the database using LINQ to entities?

View 1 Replies

VS 2008 Datatable To Class Object Using LINQ

Sep 29, 2011

I have a datatable being returned by my DAL. In my BAL I want to return a class object. So I have a class called BusinessArea that has ID, Description and Active properties. I tried this:

[Code]...

View 2 Replies

.net - LINQ To SQL A Member Defining The Identity Of The Object Cannot Be Changed?

Nov 29, 2009

I'm writing a Generic for LINQ to SQL CUD. I

'Generic Insert
Public Shared Sub Add(Of T As Class)(ByVal entity As T)
Using db As New APIUDataContext()

[code]....

Error message from Generic Update.Value of member 'Id' of an object of type 'TestAuthor' changed.A member defining the identity of the object cannot be changed.Consider adding a new object with new identity and deleting the existing one instead.What do I need to modify the Generic Update?

View 2 Replies

C# - LINQ To Object Comparing Two Lists Of Integer For Different Values?

Sep 19, 2010

I accept both C# and VB.NET suggestion, even though I'm writing an app in VB.NET I have two lists of intergers

List1 {1,2,3,5}
List2 {2,4,6,7}

I want to have new List3 {4,6,7} which is composed of elements of List2 that are not in List1. I know I can write a nice For Each loop for this but I want it done in LINQ I've been looking for such methods at Enumerable Methods, but I can't find it.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved