I am creating a C# console application for some test project, in which I need to get Root folder location (application path) of project, for example, if my project is in "
C:\Project\Program.cs", so i should get "
C:\Project\" drive as root location.
How can I get it using C# console application, in web-application we get it using
Server.MapPath("~/") but I am not sure about console application.
I want to redirect the users to certain pages on the basis of their rating. How can I use a switch case in C# ASP.NET MVC to do this? Please give me suggestions with some code part....
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.