Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

I am Jalpesh Vadgama a Microsoft MVP for Visual C# and BrainBench Certified ASP.NET Developer having more then 6 years of experience in .NET Technology.
Browse by Tags · View All
#ASP.NET 88
#DOTNET 87
BRH 79
ASP.NET 72
#.NET 52
C#.NET 48
DOTNET 47
ASP.NET 4.0 31
ASP.NET MVC 29
VisualStudio 27

Archive · View All
December 2010 16
July 2011 13
April 2011 13
April 2012 12
January 2011 12
June 2011 11
May 2011 11
May 2012 8
February 2013 7
January 2013 7

BigInteger in C# 4.0

Sep 14 2011 4:11AM by Jalpesh   

In C# 4.0 Microsoft has added so many features and I love all most all the features. In today’s post we are going to discuss BigInteger Class. During programming some complex systems often we need a very big numbers. For example if we use some of asymmetrical cryptographic feature which require to use large numbers or we can give simple example of factorial where we sometime reached to limit of data type provided by C# compiler. At that time this BigInteger data type can be very handy. You can store 232 to 264 number in this data type. So its very big and you can copy very very big number in that data type.

So let’s take a simple example to write a factorial program. BigInteger data type comes under System.Numerics namespace. So first we have to add reference to our program to System.Numerics assembly like following.

Big Integer In C# 4.0 - Add Reference to System. Numeric

Now we have added the reference to System.Numeric so we are ready for code. Here in code I have just taken a very large number in big integer which is out of range of integer to test out. So I have assigned ‘39242937852522522’ to big integer object and printed that. Following is a code for that.

using System;
using System.Numerics;

namespace ExperimentConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = 39242937852522522;
            Console.WriteLine(n);
        }
    }
}

Let’s run code and see output like following as expected its printing value.

Output

If you are run same program with integer it will not compile. It will give ‘Can not covert type long to integer error’. That’s it. Hope you liked it. Stay tuned for more.. Till then happy programming. Namaste!!
Shout it

Tags: C#.NET, #DOTNET, .NET,


Jalpesh
15 · 11% · 3548
1 Readers Liked this
Alex Liked this on 9/30/2011 2:37:00 AM
Profile · Facebook
1
Liked
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

3  Comments  

  • Either we remove the namespace or if we run same code in Vs2008 we get message as " Error Cannot implicitly convert type 'long' to 'int'. An explicit conversion exists (are you missing a cast?)"
    System.Numerics is the only namespace that comes along with .NET4 . This is good addition for developing large complex calcuation that invloces huge numbers. But in general I prefer to avoid big integers and long calculations. How abt you?

    commented on Sep 15 2011 5:50AM
    Hima
    31 · 6% · 1776
  • Very good option to fix a lot of "mines" in the code

    commented on Sep 30 2011 2:38AM
    Alex
    1343 · 0% · 17
  • What's the difference between this and a ulong?

    commented on Oct 6 2011 7:30PM
    george14215
    2026 · 0% · 8

Your Comment


Sign Up or Login to post a comment.

"BigInteger in C# 4.0" rated 5 out of 5 by 1 readers
BigInteger in C# 4.0 , 5.0 out of 5 based on 1 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]