Representing Infinity in c#

Today, I got some interesting apetite for my Blog readers,


Have you tried bringing infinity in C#.  It's really an interesting feature and a needy one if we are proceeding with mathematical calculation


Here is the small code snippet for the same,

float zero = 0;

float positive = 1 / zero;
textBox1.Text = positive.ToString(); // Outputs Infinity


zero = 0;
positive = -1 / zero;
textBox2.Text = positive.ToString();   //Outputs -Inifinity 
  
  
Cheers, 
Venkatesan Prabu .J 
Head, KaaShiv InfoTech
Ebook Download
View all
Learn
View all