Category Archives: C#

Fizz Buzz game C#

Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

Update List from another list C#.

To update a list from another list, Here is the Syntax. Syntax Example 1. Create Student model 2. Create Student List as listStudents 3. Create Student Marks as listMarks 4. Now Update listStudents from listMarks

Convert a list of string to comma separated string C#.

Convert a list of string to Comma Separated String. String.join method is used to concatenate a list of string, Using a specified separator between each string. Syntax : String.Join(string Separator, String[] Values); Example :

Get address from latitude and longitude using Bing map api

We can find address components Country, AddressLine, Postal code etc. from latitude and longitude using Bing map api. For this Microsoft provide a Bing map rest api service. Call this service using HttpClient and get response in json format. To use Bing map rest api service BingMapKey required. Create Bing map key from the portal Continue Reading…

How to fetch html from a URL in c#.

Fetching a html from an URL is easy. Class System.Net.HttpWebRequest provides an HTTP – specific implementation of the System.Net.WebRequest class.

Send email using smtp server.

We can send email using smtp server to any email address. We are using gmail smtp server to send email. For this we required Google username and password for authentication. If you want to send html text in body message than set IsBodyHtml property of MailMessage to true else false.

Enqueue and Dequeue operations on Queue in C#.

Enqueue Operations : Enqueue Operations are used to insert elements into Queue. Dequeue Operations : Dequeue Operations are used to remove elements from the Queue. Peek Operation : Peek Operation is used to get the beginning element from the Queue.

Push and Pop operations on Stack in C#.

Push Operations : Push Operations are used to insert elements into stack. Pop Operations : Pop Operations are used to remove elements from the stack. Peek Operation : Peek Operation is used to get the top element from the stack.

Difference between debug and trace in C#.

Debug It is used to debug your code in development environment only. Debugging is the process of finding and fixing errors in your code. It works when solution configuration mode is Debug. In Release mode it does not write anything on the output window. In debugging there is no such facility to differentiate between message types (Information, Error, Warning). Continue Reading…

How to destroy an object in C# ?

Destroying an object manually in C# is simple but it’s not a good practice. Assign null value to the object and call the garbage collector’s Collect() method.