score:2
Accepted answer
Below check each property and return you not empty properties
jObject.Children().AsEnumerable().ToList()
.Count(t=> !string.IsNullOrWhiteSpace( t.Values().ToList()[0].ToString()))
Note : this code is based on the object structure provided in question.
score:0
You could use int counter = jObject.Children().Count(c => string.IsNullOrEmpty(((JProperty)c).Value.ToString()));
, but see for yourself if that is more readable.
Source: stackoverflow.com
Related Query
- How to count how many fields in a JObject that are set with LINQ?
- How are people unit testing code that uses Linq to SQL
- How to count the number of elements that match a condition with LINQ
- linq how to select a parent with a child collection that contains one or many of an array (or list) of values
- How can I set properties on all items from a linq query with values from another object that is also pulled from a query?
- linq - how do you do a query for items in one query source that are not in another one?
- How do I do a linq query to find fields in a dataset that are present in every record of a set?
- Count how many cells are null in a row using Linq and c#
- how to write a Linq query with a EF code first Many to Many relationship
- How to match two Lists with only items that are different in Linq
- How to select elements from a table that are present in a junction table with LINQ - Entity Framework
- How can I do a count in Linq with many to many
- Generic code to determine how many rows from a table are in a different table with matching structure?
- How to include fields that are not the Key or aggregate in Linq Group by results?
- How to create a Dynamic Query when there's a condition that won't use all fields in the where section with LinQ
- How to use LINQ Distinct() with multiple fields
- How to Count Duplicates in List with LINQ
- Error: "The specified LINQ expression contains references to queries that are associated with different contexts"
- How to insert a record with LINQ and C# and return the Primary Key of that record
- How to Select All with a One to Many Relationship Using Linq
- Count how many items appear before an item with a specific ID
- How can I use linq to return integers in one array that do not match up with an integer property of another array?
- How can I switch that code to use LINQ
- How to convert list of objects with two fields to array with one of them using LINQ
- How does this linq code that splits a sequence work?
- how to use Linq count with group by in C#
- C# Code Contracts -- How to ensure that a collection of items contains items with unique properties?
- How to compare with previous or next element's properties in List<T> while the compare fields are dynamic?
- How do I use Linq to find the elements of a list that are not present in another list?
- The LINQ expression contains references to queries that are associated with different contexts
More Query from same tag
- What is the recommended practice for sharing similar linq to entities expression logic in different repositories
- updating multiple records in database with linq to sql without loop, is it possible?
- How to make a nested List form a List
- Unit Testing Entity Framework
- How to pre-load data in an OWIN self-hosted app
- C# Reading and Summarizing Text File with LINQ
- Get max items in array of lists
- Filtering by plain date SQL to Linq syntax
- How to convert List<string> to IEnumerator<string>
- Compare two list of objects and select common and difference records based some property
- Order for autocomplete
- LINQ retains unwanted data binding
- Getting Stackoverflow exception when executing LINQ IQueryable method
- How can I see the SQL text that is sent by LINQ to my database?
- LINQ: Query to get information from 2 tables
- GroupJoin returning Sequence contains no elements
- Generic Return Type of Linq Query and String.Join bad use
- DataColumn: combine columns and values into a string
- C# sort string alphabetically followed by frequency of occurrence
- Linq query for latest status in asp.net
- C# IQueryable - How to query a list inside another list
- Convert DataTable to IEnumerable<T> in ASP.NET Core 2.0
- Logic Evaluator in c# (Evaluate Logical (&& ,|| ) expressions)
- Partition enumerable according to precedence
- Entity framework navigation property FirstOrDefault()
- C# parsing xml document with LINQ where there are varying number of duplicate elements
- Linq to sql - aggregation not being executed on database server
- searching a date list
- Alternative to use a method in a query to the database in c# using entity framework
- How to properly search xml document using LINQ C#