Pass Generic List To A Function That Has A Custom Defined List

Apr 7, 2011

it seems always at this time I cant figure out how to do something maybe it has something to do with lunchtime.

Im having trouble using a method that is defined by an outside company

This is a link to their integration guide:


This is their documentation for the class Im trying to use

OrderQueryWebService Class

This class is for SID in particular and is made for use with the notification methods. This is for the Order Query Web Service specifically, allowing clients to return the status of transactions for their merchant, whenever they want to.

/ <summary>
/ Pass through the variables required and receive a list of Transaction
objects showing transaction status


The MerchantCode, the MerchantUsername, the MerchantPassword are all good the List is a custom type called SetComHash.Transaction

Everytime I try adding a string to the list such as the transactionNumber and some other values it gives me a type error:

"Value of type string cannot be converted to 'SetcomHash.Transaction'


Add Custom Class To A Generic List?

May 10, 2010

I created two classes. One class is StudentClass and the other is HomeroomClass. The HomeroomClass contains a readonly property as a generic list of the StudentClass. [code]...

View 6 Replies View Related

Generic Function For List Type Filter?

Jan 13, 2011

I would like to write a generic function that would search a List(Of T) for all elements of type TFilter and return a List(Of TFilter) which comprises those elements.

I've tried this:
Public Function FilterList(Of T, TFilter)(ByVal ListToFilter As List(Of T)) As List(Of TFilter)
Return ListToFilter.FindAll(Function(z) z.GetType.Equals(GetType(TFilter))).ConvertAll(New Converter(Of T, TFilter)(Function(z) CType(z, TFilter)))
End Function

But, it gives the following error:
Value of type 'T' cannot be converted to 'TFilter'.

View 2 Replies View Related

Error:'Feedback' Must Implement 'Function GetRuleViolations() As System.Collections.Generic.List

Mar 20, 2009

I need another (dozen) pair of eyes on this. The following code:

Interface iRuleEntity
Function GetRuleViolations() As List(Of RuleViolation)
End Interface
Partial Public Class Feedback


is giving me this error:'Feedback' must implement 'Function GetRuleViolations() As System.Collections.Generic.List(Of RuleViolation)' for interface 'iRuleEntity'.

View 2 Replies View Related

Determine If Property Is Generic List<of T> Via Reflection And Loop List Items

Oct 1, 2009

I'm looping all the properties in an object via reflection:

For Each p As PropertyInfo In values.[GetType]().GetProperties()
If p.CanRead Then
'Do stuff
End If

how to determine whether the property in question is a generic List(Of T)? If it is I need to loop the list itself.

I've experimented with GetType and TypeOf but have not managed to get anything working.

To clarify, I want to keep this generic. I do not want to specify the type of T, I need to loop the list items and call the ToString method on each item. T could be one of a number of different types (application specific reference types). Is it possible to do this without specifying types?

(VB.NET 2005 with .Net 2.0)

View 3 Replies View Related

Get Type Of Derived Generic List Class From List Item Method?

Mar 23, 2011

Public Class notifierMain
Public Class Contacts
Inherits List(Of row)
Public Sub New()


When I debug this winforms application I get curType = "notifier.notifierMain+Contacts+row" I want to the Validate function to know it is in MyContacts. How do I do this?

View 3 Replies View Related

Convert A List Linq Expression To Defined List Class?

May 26, 2012

y have this class

Private Class MyClass
Public Property propertyOne() as String
Public Property propertyTwo() as String


View 2 Replies View Related

.net - Returning A List Using Entity Framework, 'System.Collections.Generic.List Cannot Be Converted To '1-dimensional Array

May 3, 2012

i have issue returning a list in a web method. here is the code

<WebMethod()> _
Public Function getTags(para_parents As String) As List(Of getTypeDetailsByParentName_Result)()
Dim context As New PPEntities


the error is

Value of type 'System.Collections.Generic.List(Of SaftyonRoad.getTypeDetailsByParentName_Result)' cannot be converted to '1-dimensional array of System.Collections.Generic.List(Of SaftyonRoad.getTypeDetailsByParentName_Result)'

View 1 Replies View Related

Pass A Parameter From The Select List Into A Function For Joining A Linq Query?

May 25, 2010

I have a query that can be summarised in SQL as follows;

StockToCheck As S


Where the S var is a list of strings. This gives the error 'S' is not declared and points to the S in the function call / join (GetPOSStock). So it does not seem possible to do this in Linq, can anyone confirm?

View 1 Replies View Related

.net - Sort Generic List Based Upon A Different List?

Oct 29, 2010

What would be the fastest way to sort a list that contains a list of objects, based upon another list? An example follows:Say I have multiple lists of employees. Each individual list has a common property value, say "Department". So I have a list of employees, in one list they all have the department string value of "Sales". In another list all the objects have a department value of "Finance". These lists of employees are then contained in a list which holds them all.

I have a second list, which should drives the sort order of the employee lists. The second list simply contains a list of strings like, "Finance", "Sales", "IT" and so on. I'd like my lists of customers to be sorted in the order of "Finance", "Sales", etc.I'm using VB.NET in .NET 2.0

View 1 Replies View Related

Generic TypeOf Operator - See If List Is A List(Of T) Variable - Error: "Type Expected"?

Jan 5, 2011

Dim x = GetType(List(Of )) 'valid statement
Dim list As New List(Of String)

Now I want to see if list is a List(Of T) variable: Dim isList = TypeOf list Is List(Of ) On the last line I get a compile error: "Type Expected". Is there any cheap-performance TypeOf operator alternative for generics?

View 2 Replies View Related

Can A Generic List Of T Be Passed To Function Similar To Way An Array Is Passed?

Mar 23, 2012

I want to pass a List of T where T is an object I've created that has about ten properties (strings, dates and integers).The lst passes to the function successfully.  I am also passing an New T of the Object (itm as T).I can see all the values (see image below), but because it's generic I cannot seem to retrieve the property values and I cannot figure out how to iterate through the properties of each itm as they are retrieved in the For Each.[code]

View 10 Replies View Related

Error - Red "List" Says Too Few Type Arguments To System.Collections.Generic.List(Of T)'

Mar 12, 2009

I have converted c# .cs to vb:= I have 6 errors on:

Red "List" says Too few type arguments to system.Collections.Generic.List(Of T)'
Orange "Calendar" says Value of type 'System.Windows.Forms.Control.ControlCollection' cannot be converted to 'Form1.Kobush.Windows.Forms.Appointment'.


View 6 Replies View Related

.net - Creating A Generic List Of A Generic Type

Jun 30, 2011

I am trying to create a list of a generic type in 2.0 framework.
This is the generic type definition:

Public Class GenericParamMap(Of T)
Public Sub New(ByVal pParamName As String, ByVal pPropValue As T)
mParamName = pParamName


The compiler does not allow a "T" in the method's parameter because it's not defined, but I'm not sure how or where to define it. I thought it was okay to have a generic method definition.

View 2 Replies View Related - Convert From Custom List To List Of String

Mar 25, 2010

I have the following code:


The intention is to convert an IList of custom objects to a string equivalent comprising each element in the Ilist. Unfortunately I can't seem to find a way to get the underlying data of the custom object, and of course as in the above example, using object simply gives me a string of types definitions, rather than access to the underlying data.

View 2 Replies View Related

Pass A Generic Type Not Having A Interface To A Of T Function?

Jun 8, 2009

I have a following code which works fine

MsgBox(AddSomething(Of String)("Hello", "World"))
Public Function AddSomething(Of T)(ByVal FirstValue As T, ByVal SecondValue As T) As String
Return FirstValue.ToString + SecondValue.ToString


View 3 Replies View Related

.net - Create And Pass Custom Function As A Delegate?

Aug 5, 2009

I have a function Process(data, f) where data is a normal parameter and f is a function needed to process the data (passed as a delegate to Process)

The signature of f is int f(a,b,c), with a, b, c supplied by Process when it calls the delegate.

Up until here, standard delegate usage.

Now, I have a special but common case where I would like to call Process with a constant f function. So I would like to write SimpleProcess(data, k) so that the caller does not need to create a delegate in this case, just pass the constant k (the only information needed).

So I need to dynamically create a constant function, g(a,b,c) which takes 3 parameters (which are ignored) and always returns k. This has to be done within the SimpleProcess function, so that I can then simply call Process(data, g) from within that function, without the need to rewrite the whole Process function for this special case.

View 3 Replies View Related - Find The Max Id From A Generic List?

Oct 13, 2011

i m getting a collection of data in list's object. And from this list i want to get the maximum id.`

Dim objinfo As List(Of AlbumInfo) = objPhotos.GetPhotos_Alb_ID(Me.ModuleId, hdd_AlbID.Value)
Dim Photo_Image As String = ""
Dim str As String = Photo_Image & fu_Photo.PostedFile.FileName.Substrng(fu_Photo.PostedFile.FileName.LastIndexOf("."))


this returns the "0"th positions id from Convert.ToString(objinfo.Item("0").Photo_Id + 1)but i want to get the last item's id.

View 17 Replies View Related

C# - Sum Of A Column Of Generic List?

Jan 5, 2011

i have list of string like this :

Dim totalPrice As New List(Of Integer)

how can i get sum of column(0) (C# or VB) ?

View 4 Replies View Related

Generic List, Add, And Same Values?

Jan 17, 2011

<div class=PhorumReadBodyText>Hi, I have a problem with adding of items to generic list, problem is when I insert 1. item to the list, everithing is ok, but if I insert second item, first and second has same values. 

code looks like that ( 4.0): </div> <div class=PhorumReadBodyText> </div> <div class=PhorumReadBodyText>Partial Class _Default
Inherits System.Web.UI.Page


View 1 Replies View Related

How To Add Items To Generic List

Jan 17, 2011

I have a problem with adding items to generic list, problem is when I add 1. item to the list, everything is ok, but when I add second, first and second has the same values...

This is code ( 4.0):
Partial Class _Default
Inherits System.Web.UI.Page
Public Class Product
Shared Property Material As String

View 7 Replies View Related

Loop Through Generic List

Aug 26, 2009

In my application I am populating my customer object and looping through it as shown below.As there are thousands of customers, I want to do it 500 customers at a time.Is there anyway I can have one more For loop to process 500 customers at one shot in vB.netI am not using LinQ as the database is Oracle.[code]

View 2 Replies View Related

Looping Through Generic List?

Apr 30, 2010

I want my loop to loop until it reaches the last string in my generic list. I know I could simply insert the last index of the list as an integer but I want to be able to use this if my list grows too. How could I achieve this?

View 5 Replies View Related

Searching A Generic List

May 14, 2009

I have been reading extensively about searching generic lists in VB.NET with the usage of delegates.However, I still cannot seem to grasp how to achieve what I want to, which I believe is frustratingly simple! I have a list populated with instances of an object with three parameters (fields/ variables).When I receive a new object to add to the list I want to search the list for the "layer" field.If the field matches then I will replace that row (object) in the list with the new object, if no match is found then I will add it to the list. [code]

View 3 Replies View Related

Splitting A Generic List?

Jun 11, 2011

i have a generic list of type datarow.i have to split this list at an index and then use both parts of the list.

View 2 Replies View Related

Changed To A List Of Defined Entries In The UDT?

Jul 8, 2011

Instead of a UDT containing a string variant ie If .view="Left" then

Can it be changed to a list of defined entries in the UDT If .view.Left then

I could define the subentities as boolean but each time I change one I would have to change the others

.view.Left = True

It would just make coding a bit faster. I don't know if it's possible but I've been surprised in the past when I didn't think something was possible.

View 6 Replies View Related

.net - GroupBy 2 Values In A Generic List?

Aug 18, 2010

I'm using VB.NET on Framework 2.0. I'm looking to quickly group a Generic List<> by two properties. For the sake of this example lets say I have a List of an Order type with properties of CustomerId, ProductId, and ProductCount. How would I get the average of ProductCounts grouped by CustomerId and ProductId in VB.NET ?Unfortunatly I cannot do this at DB level (which would have been easy). Also I cannot use LINQ or Lambada as Im on Framewwork 2.0. So I need to do this at application level in The list is returned to me sorted by CustomerId and ProductId so I guess with a few loop sI should be able to create a average value for but there must be a cleaner way to do this?

View 1 Replies View Related

.net - Iterating Through Generic List Of String?

Jan 28, 2012

I have the follow code in my program where I hit a SQLCe database to append the results into a list. That part works, but instead of exiting the function 'QueryDB' it goes to the else statement and runs the function again, which will return a null value. I designed it this way becuase I wanted to check to make sure the database is open before I try to execute the SQL statement, and if it's not open, call the method to open it and run through the function again.


View 1 Replies View Related

.net - Sort Generic List On Two Or More Values?

May 15, 2009

We have a generic List(Of Product) that must be sorted on two or more properties of the Product class.

The product class has the properties "Popular" numeric (asc), "Clicked" numeric (desc), "Name" string (asc). In order of naming the properties we want the list to sort.

How can it be sort with an lamba statement? If have found to sort the list based on one property.

View 4 Replies View Related - Linq To Sql Convert To Generic List In .NET?

Jul 2, 2009

I am trying to learn some VB.NET for my coo-op that starts next week, and for that reason i took my portfolio web site that is on C# and just started to converting it to VB.NET to get familiar with the syntax.

I am sure my problem is simple however i have a hard time solving it. I am trying to grab data with the linq query and then return it as list to bind to the Repeater.I have the following function:


And it would work fine. However if I try to use ToList() in VB.NET i am getting error that it cannot convert it from ling to sql List to the generic list. How do i do this convertion in VB.NET ? or maybe there is another way ?

I am decent when it comes to C# however somewhat lost with the VB.NET syntax.

View 1 Replies View Related

Better Way Of Filling A Generic List From A SQL DataAdapter?

Apr 11, 2009

I have an existing application that uses Active Record for its data retrieval. It's in VB.NET (first time I'm doing VB.NET; I usually work in C#). And I'm building a method to return a List(Of T) of an object. The current pattern uses a SQLDataAdapter to populate a datatable. I COULD add the record to the List(Of T) as I fill the datatable, but there HAS to be a better way to do this.

View 1 Replies View Related

C# - Get Values From An Enum Into A Generic List?

Nov 21, 2011

I don't know how to convert the following line from VB to C#:

Dim values As New List(Of T)(System.Enum.GetValues(GetType(T)))

My version doesn't work:

List<T> values = new List<T>(System.Enum.GetValues(typeof(T)));

The best overloaded method match for 'System.Collections.Generic.List.List(System.Collections.Generic.IEnumerable)'
has some invalid arguments

The constructor-parameter doesn't take it that way - what cast (or else) am I missing?

For clarification: It is wrapped up within the following generic method

public static void BindToEnum<T>()
List<T> values = new List<T>(System.Enum.GetValues(typeof(T)));

View 2 Replies View Related

Conversion Of An Array To Generic.list?

Nov 2, 2005

We are currently converting a larger legacy application from .Net1.1 to .Net2.0, both VB. Our new standard is Generic List, instead of arrays.We are recoding component by component. And while not everything is yet stored in generic.list we end up with compile time errors.Converting from generic.list to array is supported with myGenList.ToArray().But from array to generic list isnt that easy."Value of type '1-dimensional array of something' cannot be convertet to 'System.Collection.Generic.List(of something)"I know for sertain that the array consist of the type 'something', so an runtime exception converting is ok.Is there a good way to do the workaround untill the hole application is recoded?

View 1 Replies View Related

Convert DataSet To Generic List?

Mar 11, 2012

How do you convert a DataSet to generic list.I see that in C# you can use .toList(). I'm using .net3.5 vs2008 vb?

View 5 Replies View Related

Creating A Generic List Of A Specified Type?

May 26, 2010

I want to create a generic list - but I want to specify the type at runtime - is there a way I can do this? using reflection perhaps?Something like this...

Public Shared Sub create(ByVal t As Type)
Dim myList As New Generic.List(Of t)
End Sub

View 2 Replies View Related

Displaying A Generic List In A MessageBox?

Apr 25, 2010

I can't seem to get the syntax right for this. I have a structure stored in a generic list and when it displays I get this "GenericList_T_.Form1+stuMotorInfo" in the messagebox. I've tried a few things and get roughly the same thing. 

Here is the code:

Option Strict On
Public Class Form1
Private Structure stuMotorInfo
Public MotorId As String


View 5 Replies View Related

Generic List - How To Get Data From TXT File

Jan 4, 2012

I'm looking for a method for reading data from a txt file. The text file have this kind of structure (fixed length fields):

I have to get them in groups by first field, in some kind of list of dictionary lists or something like this. For this particular example the solution would be:
id(list): 0000,1111,2222.....
(content)List: 0000
field1(list): AAAAAA,JJJJJJ
field2(list): BBBBBB,III
field3(list): CCCCCCCC,RRRRRR
(content)List: 1111
field1(list): XXXX,WW,XXXX
(content)List: 2222
field1(list): XXXX...
field2(list): YYYYYYYY...
field3(list): ZZZZZZZZ...

Right now I have the the whole text stored in a list of strings (one per line).

View 2 Replies View Related

Generic List Class Cast?

Jun 10, 2010

how Inheriting List(of T) should work.It seems like what I have below should work but at runtime I get the error:[code..]

If I want to cast a List(of x) to the class xlist, how should I do that?[code...]

View 15 Replies View Related

Getting A Reference To A Generic List Item?

Jun 2, 2011

Does anybody know  how to pass a reference to the current item in a generic list, when processing that list? In VB.NET you have to use a delegate wrapper to pass parameters in a delegate, which I have set up OK, but I don't know how to get a reference to the current item that would be the parameter used at in the example below. Using the Current property of the list enumerator doesn't seem to work, but how else could this be done?


View 1 Replies View Related

Grouping A Generic List Via LINQ?

Jun 26, 2011

I need to take a collection and group it via Linq but all the examples I've seen fail in some manner or other with some syntax difference that I can't quite lick.

My collection:

Dim a As New List(Of ProcessAlert)
a.Add(New ProcessAlert("0000112367", "", "Alert", 2))
a.Add(New ProcessAlert("0000112367", "", "Document", 2))


View 1 Replies View Related

Copyrights 2005-15, All rights reserved