score:5
this is about lambda syntax, the part on the right is a normal method body that you may shorten when it is 1 expression or 1 statement. otherwise, use full { }
and ;
app.uselccors(o => {o.version = "1.0"; o.appid = 2; });
score:1
you probably want to give a lccorsoptions
in the initialization of your app. can't you do something like this:
app.uselccors(new lccorsoptions{version = "1.0", appid = 2});
score:3
i'm assuming you're using an extension method that's something like this:
public static void uselccors(this list<lccorsoptions> list, action<lccorsoptions> action)
{
foreach (var item in list)
{
action(item);
}
}
if so try to put some braces after the lambda sign like this:
app.uselccors(x => { x.version = "1"; x.appid = 1; });
is this what you've been looking for?
Source: stackoverflow.com
Related Query
- How to set multiple properties using Lambda in Action delegate
- How to set multiple values in a list using lambda expression?
- How to gather multiple int properties from a list of objects in a list of integers using lambda or linq?
- How to order by multiple columns using VB.Net lambda expressions
- How to reuse a linq expression for 'Where' when using multiple source tables
- How to get Multiple Result Set in Entity Framework using Linq with C#?
- How to combine multiple lists using LINQ lambda
- How to write the same code using Lambda Expression
- How to filter entity framework result with multiple columns using a lambda expression
- How do i get specific columns from a thenInclude using Include with Multiple Levels of Properties
- How to return multiple rows using LINQ lambda expression from SQL Server 2014?
- How to sort list on multiple properties in one line of code in Linq
- How to set properties using Linq statement
- How to set multiple property values with same name and counter value using reflection?
- How I can improve the code using lambda expressions?
- How to Implement search method for db records with multiple filters using lambda expressions
- How to execute an update on multiple rows using Linq Lambda Expression in ASP.Net MVC?
- Set multiple properties in a List<T> ForEach()?
- how to update the multiple rows at a time using linq to sql?
- How to perform Join between multiple tables in LINQ lambda
- How do I find the text within a div in the source of a web page using C#
- How to set property value using Expressions?
- How to select multiple values from a Dictionary using Linq as simple as possible
- linq to sql join on multiple columns using lambda
- How Build Lambda Expression Tree with multiple conditions
- Using LINQ to find duplicates across multiple properties
- How can I combine two lambda expressions without using Invoke method?
- How to query a nested list using a lambda expression
- Using LINQ to group by multiple properties and sum
- How to Convert LINQ Comprehension Query Syntax to Method Syntax using Lambda
More Query from same tag
- Pairing two arrays
- How to combine LINQ and Lambda?
- Selecting column from LINQ query where cells equals value from a list
- How to use JSON.Net to read JSON and output HTML?
- Insert into multiple tables (one to one relationships) with Linq queries and SQLite
- Sum property based on existance in list and quantity
- Handling null values for C# linq where query
- Does Linq to Entities throw SqlExceptions?
- Why can't I use Linq Select in subclass of List<string> using base.Select?
- Bind Generic list to entity inside enity
- linq not supported filter by the first element of a list?
- Linq query to find specific image but fall back upon order if can't find it
- Chart of IEnumerable LINQ equivalents in Scala?
- GroupBy and Distinct don't work
- How to get enumerable range with a variable step count
- C# Creating an Expression in runtime with a string
- MySql get transactions that occurred with the current date
- when does LINQ outperforms ado.net
- is nested Linq faster than foreach loop?
- Specified Cast Invalid Byte to int
- Exclude uninitialized (null) properties in Fluent assertion
- Limit queried columns based on list set in runtime
- List.except on custom class
- How to use LINQ query with DataGridView but a subset of table columns?
- How to use generic list in place of dataset/datable in asp.net?
- Parsing a user submitted search query
- Is there a way to call ExecuteQuery on a SQL DataContext and return a Tuple instead of a class/object
- unable to persist newly added tags in xml using LINQ
- C# interpret my query as inner join instead of left outer join on what cases this occurs?
- LINQ : Join 3 datatables and add calculated field