score:3
Accepted answer
This should be possible like this:
//long way
string sline=arQuery.GetType().Name + " ";
foreach (PropertyInfo info in arQuery.GetType().GetProperties())
{
if (info.CanRead)
{
sline += info.Name+": "+info.GetValue(arQuery, null) + " ";
}
}
//using LINQ without the for loop
sline += string.Join(" ", arQuery.GetType().GetProperties().Where(i=>i.CanRead).Select(i=> ""+i.Name+": "+i.GetValue(arQuery, null)));
Hope there are not too many typos ;)
Source: stackoverflow.com
Related Articles
- Using C#, LINQ - want to get column names AND data values
- How to check comma separated values stored in data base column having the given value using linq in c#
- want to get data from specific column of azure mobile service table using linq
- Select All distinct values in a column using LINQ
- Combine tables using row values as column LINQ C# SQL
- Count distinct values of a column in dataGridView using linq in .NET
- Selecting rows with distinct column values using LINQ
- Eliminate comma(,) from a column of a Data Table using LINQ
- I want to get most frequent values using LINQ
- Change values of datatable column conditionally using Linq
- How to get sum of data in a list using multiple column values
- Separating the column values of DataTable using LINQ
- read icollection data using LINQ in C# code
- Using Dynamic Column Names in a Linq Query
- Using LINQ query result for data source for GridControl c#
- how to get two column values in a single query using linq to entities
- In a table a column datatype is varchar, retrieve only those values of the column which are number / numeric using linq to sql
- To concatenate values of a particular column in multiple rows using linq
- Exclude null values while summation by specific column in a left joined table using LINQ
- Use linq to find DataTable(Name) in a DataSet using unique list of Column Names
- Boolean column in Microsoft Access and filtering data using linq
- How to throuhly join two datatables using linq without column names
- Values are same but names are different using linq
- Using linq to group by dates with values for empty data
- Using LINQ Query DataTable using partial column names
- How can I move on column data to another column in the same row using linq
- How to concatenate all child elements with same names values using LINQ to XML
- Could i mix values from local data with values returned from database while using LINQ to SQL?
- order datatable by relevance using linq by column values which are comma sperated
- Is there a way in linq wherin i can insert a row(from dictionary) in datatable using the list of column names c#?
- How to make this linq efficient
- LINQ: How to filter collection by data in related table
- Using Linq to query linked server in Visual Studio
- How to use Linq in IQueryable
- Detect customer profile changes
- How does linq concat work under the hood?
- what is the mechanism for performing an intersect in a Mongo Linq query
- Linq query problem
- Linq query problem (too many ado.net request)
- How To Sort A List Of Lists?
- LINQ to calculate a moving average of a SortedList<dateTime,double>
- Linq SubmitChanges does not work
- Is null-checking on Linq queries idiomatic?
- Can LINQ To SQL generate invalid SQL?
- Linq Nullable object must have a value. errors in .NET 6 and EF Core
- Dynamic Linq select statement
- LINQ sum datatable column where
- Why are stored procedures, functions, and views put into a .dbml file instead of the code file?
- How can I concatenate the array content with its index value
- replace joins with navigation properties