12349 2
how to implement switch case in Razor (.cshtml)?

I need to implement switch case in Razor C# page as if-else would not be a good idea, because it will create too many conditions, so i thought to create Switch case instead, here is my current code, but it throwing syntax error

...
Type
Question
2633 2
What is the Difference between String and string in C#?

Although I have intermediate knowledge of asp.net & C#, but I am still not clear with what's the difference between String (capital S) and string in C#?

When to use which one?

Example code:

...
Type
Question
18942 2
Git push error "git did not exit cleanly (exit code 128)" , how to solve?

When I am trying to push my new commit using Tortoise-Git on server, I am getting this error "git did not exit cleanly (exit code 128)", here is the image of the issue

...

Type
Question
15686 2
Unable to update the EntitySet because it has a DefiningQuery and no InsertFunction element exists in the ModificationFunctionMapping element to support the current operation

I am trying to enter a new value in my database table row using Entity Framework in my asp.net MVC application, but getting this error

Unable to update the EntitySet because it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element to support the current operation.

How can I solve it, any suggestions or help? thanks

...
Type
Question
6087 1
How to show success message in JSON format after saving data using Web-service in C#?

I am trying to save data into database using web service[asmx], after saves successfully data into table I want to show successful message in JSON format 

Here is my code:

...
Type
Question


12412 3
Convert string of "dd/MM/yyyy" format into Datetime using C#?

I am using the code below to convert my string which is in the format "dd/MM/yyyy" into datetime

...
Type
Question
2262 1
How to access a variables and functions of a specific class from another class in C#

How to access variables and functions of a specific class from another class in C#

Please give an example.

...
Type
Question
23635 3
How do i format or beautify code in Visual Studio code?

I have just started using Visual Studio code, but i am not able to format code in it, I have tried ctrl k+ Ctrl d but it doesn't work, any helpful link for it?

...
Type
Question
18910 2
"Invalid URI: The format of the URI could not be determined" Error in C#

I am trying to run the below code in my asp.net MVC web-application, to get the URL of first image(<img>) in the HTML string, using the code below

       public static List<Uri> FetchLinksFromSource(string htmlSource)
        {
            List<Uri> links = new List<Uri>();
            string regexImgSrc = @"<img[^>]*?src\s*=\s*[""']?([^'"" >]+?)[ '""][^>]*?>";
            MatchCollection matchesImgSrc = Regex.Matches(htmlSource, regexImgSrc, RegexOptions.IgnoreCase | RegexOptions.Singleline);
            foreach (Match m in matchesImgSrc)
            {
                string href = m.Groups[1].Value;
                links.Add(new Uri(href)); //getting error here
            }
            return links;
        }

but I am getting this error "Invalid URI: The format of the URI could not be determined" when I run this code, here is the image of the error

...

Type
Question
5828 1
Redirect users to a view using Switch case in asp.net MVC?

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.

...
Type
Question

Page 21 of 24