Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# use list as a paramter

You should always avoid using List<T> as a parameter.
Not only because this pattern reduces the opportunities of the caller to store the data
in a different kind of collection,but also the caller has to convert the data into a 
List first.Converting an IEnumerable into a List costs O(n) complexity which
is absolutely unneccessary. And it also creates a new object.
TL;DR you should always use a proper interface like IEnumerable or IQueryable based 
on what do you want to do with your collection. ;)

In your case:

public void foo(IEnumerable<DateTime> dateTimes)
{
}
Comment

c# use list as a paramter

You should always avoid using List<T> as a parameter.
Not only because this pattern reduces the opportunities of the caller to store the data
in a different kind of collection,but also the caller has to convert the data into a 
List first.Converting an IEnumerable into a List costs O(n) complexity which
is absolutely unneccessary. And it also creates a new object.
TL;DR you should always use a proper interface like IEnumerable or IQueryable based 
on what do you want to do with your collection. ;)

In your case:

public void foo(IEnumerable<DateTime> dateTimes)
{
}
Comment

c# use list as a paramter

You should always avoid using List<T> as a parameter.
Not only because this pattern reduces the opportunities of the caller to store the data
in a different kind of collection,but also the caller has to convert the data into a 
List first.Converting an IEnumerable into a List costs O(n) complexity which
is absolutely unneccessary. And it also creates a new object.
TL;DR you should always use a proper interface like IEnumerable or IQueryable based 
on what do you want to do with your collection. ;)

In your case:

public void foo(IEnumerable<DateTime> dateTimes)
{
}
Comment

c# use list as a paramter

You should always avoid using List<T> as a parameter.
Not only because this pattern reduces the opportunities of the caller to store the data
in a different kind of collection,but also the caller has to convert the data into a 
List first.Converting an IEnumerable into a List costs O(n) complexity which
is absolutely unneccessary. And it also creates a new object.
TL;DR you should always use a proper interface like IEnumerable or IQueryable based 
on what do you want to do with your collection. ;)

In your case:

public void foo(IEnumerable<DateTime> dateTimes)
{
}
Comment

c# use list as a paramter

You should always avoid using List<T> as a parameter.
Not only because this pattern reduces the opportunities of the caller to store the data
in a different kind of collection,but also the caller has to convert the data into a 
List first.Converting an IEnumerable into a List costs O(n) complexity which
is absolutely unneccessary. And it also creates a new object.
TL;DR you should always use a proper interface like IEnumerable or IQueryable based 
on what do you want to do with your collection. ;)

In your case:

public void foo(IEnumerable<DateTime> dateTimes)
{
}
Comment

c# use list as a paramter

You should always avoid using List<T> as a parameter.
Not only because this pattern reduces the opportunities of the caller to store the data
in a different kind of collection,but also the caller has to convert the data into a 
List first.Converting an IEnumerable into a List costs O(n) complexity which
is absolutely unneccessary. And it also creates a new object.
TL;DR you should always use a proper interface like IEnumerable or IQueryable based 
on what do you want to do with your collection. ;)

In your case:

public void foo(IEnumerable<DateTime> dateTimes)
{
}
Comment

c# use list as a paramter

You should always avoid using List<T> as a parameter.
Not only because this pattern reduces the opportunities of the caller to store the data
in a different kind of collection,but also the caller has to convert the data into a 
List first.Converting an IEnumerable into a List costs O(n) complexity which
is absolutely unneccessary. And it also creates a new object.
TL;DR you should always use a proper interface like IEnumerable or IQueryable based 
on what do you want to do with your collection. ;)

In your case:

public void foo(IEnumerable<DateTime> dateTimes)
{
}
Comment

c# use list as a paramter

You should always avoid using List<T> as a parameter.
Not only because this pattern reduces the opportunities of the caller to store the data
in a different kind of collection,but also the caller has to convert the data into a 
List first.Converting an IEnumerable into a List costs O(n) complexity which
is absolutely unneccessary. And it also creates a new object.
TL;DR you should always use a proper interface like IEnumerable or IQueryable based 
on what do you want to do with your collection. ;)

In your case:

public void foo(IEnumerable<DateTime> dateTimes)
{
}
Comment

c# use list as a paramter

You should always avoid using List<T> as a parameter.
Not only because this pattern reduces the opportunities of the caller to store the data
in a different kind of collection,but also the caller has to convert the data into a 
List first.Converting an IEnumerable into a List costs O(n) complexity which
is absolutely unneccessary. And it also creates a new object.
TL;DR you should always use a proper interface like IEnumerable or IQueryable based 
on what do you want to do with your collection. ;)

In your case:

public void foo(IEnumerable<DateTime> dateTimes)
{
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: unity Polymorphism 
Csharp :: how to colapse all methods visual studio 
Csharp :: enum extends dictionary c# 
Csharp :: c# check if value in dictionary are unique 
Csharp :: filter enum using linq query 
Csharp :: Handle all AggregateExceptions when using Task.Whenall() async 
Csharp :: how to select class object from query c# 
Csharp :: WixSharp-FirewallException 
Csharp :: c# psobject get value 
Csharp :: get local position unity 
Csharp :: C# free text search 
Csharp :: how to validate decimal number with percision of (25, 4) iin c# 
Csharp :: add integer to string c# 
Csharp :: unity Texture2D efficient performance draw pixels 
Csharp :: one to many relationship in asp net entity framework with role 
Csharp :: c# stack 
Csharp :: Reading a date from xlsx using open xml sdk 
Csharp :: length of arr c# 
Csharp :: integer to boolean conversion in unity C# 
Csharp :: c# position of character in string 
Csharp :: unity new input system get button down 
Csharp :: c# application exit 
Csharp :: C# Bitwise and Bit Shift operator 
Csharp :: how to mirror an image in vs forms 
Csharp :: enemy turret one direction ahooting script unity 2d 
Html :: calling javascript file in html 
Html :: regex find html comment 
Html :: href email in html 
Html :: html disable enter submit 
Html :: html head logo 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =