By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,041 Members | 1,056 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,041 IT Pros & Developers. It's quick & easy.

Using (Of T) generic with functions in Visual Basic 2012

9815402440
100+
P: 180
Hi folks,
can you please explain what (Of T) is after function name in following line:
Expand|Select|Wrap|Line Numbers
  1. Public Function StdDev(Of T)( source As IEnumerable(Of T), selector As Func(Of T, Decimal)) As Decimal
  2.  
I am using visual basic 2012 .
I understand that this function will extend IEnumerable(Of T) and gets one delegate as parameter, but I could not get what is (Of T) in this declaration
Nov 14 '13 #1
Share this Question
Share on Google+
2 Replies


!NoItAll
100+
P: 296
Of Type
Lets you set the type.
A very common use is
Friend MyList as List(of String)

MyList is now a list of strings. The List class gives you much more control than a simple array has to offer. For example you can use MyList.add("string") to add something to the end of the list or MyList.add("String", 2) to add a new element to index position 3. You can also remove items from the middle, etc and all the management is done for you.
Nov 19 '13 #2

9815402440
100+
P: 180
function is declared as
StdDev (Of T)( source As IEnumerable(Of T), selector As Func(Of T, Decimal)) As Decimal

can you please explain what bold text means in the declaration?
Nov 20 '13 #3

Post your reply

Sign in to post your reply or Sign up for a free account.