I am trying to optimise my query to get data from database, so I would to know how can I directly run a sql query in my C#.
Currently I am using Entity framework with EDMX, so to improve query time, I would like to know how can I run direct sql query?...
I am trying to add
List.GroupBy(a=>a.ProductType.Name).Select(a=>a.FirstOrDefault()), now here I can have null values for .ProductType or .name so how can I ignore null values in C#, so I can get proper results of GroupBy?
If I am using above query in C#, I am getting error
Object reference not set to an instance of an object
I tried to make it like
List.GroupBy(a=>a.ProductType != null ? a.ProductType), but it doesn't work.
Hello, I would like to create a helper function in the class, which can be used by multiple List types at the same, so how can I create initialize or create function to pass
T can be any type of class in C#?
I wanted to remove double quotes from a string using C#, How can I do that easily and efficiently?
For Example, I have string : "-10,20", how to get output -> -10,20
Hello, I would like to know, How can I convert a positive number ( int type) to a negative number in C# and vice-versa ( negative to positive number using C#)?
I would like to know, how can I delete a file, after checking if it exists on the hard disk, if yes, then delete it, using C# in asp.net?