Prev: "Add Webreference" in VS2008 .NET 2.0 project won't generate dynamiccode...
Next: .NET Framework freezes the PC
From: Jochen Kalmbach [MVP] on 19 Jan 2010 01:56 Hi PvdG42! >> Please can someone give a simple usage example? > > I'm as frustrated as you are. After reading your post and the responses > you got, I thought "how hard could it be?" and now I'm stumped. So, > meaning no disrespect to anybody, I'm forwarding this to the C++/CLI > group to see what happens :-) What examples do you want to see? It is no big problem to translate C# into C++/CLI... For example: BigInteger negativeNumber = -1000000; BigInteger positiveNumber = 15777216; string negativeHex = negativeNumber.ToString("X"); string positiveHex = positiveNumber.ToString("X"); BigInteger negativeNumber2, positiveNumber2; negativeNumber2 = BigInteger.Parse(negativeHex, NumberStyles.HexNumber); positiveNumber2 = BigInteger.Parse(positiveHex, NumberStyles.HexNumber); Console.WriteLine("Converted {0:N0} to {1} back to {2:N0}.", negativeNumber, negativeHex, negativeNumber2); Console.WriteLine("Converted {0:N0} to {1} back to {2:N0}.", positiveNumber, positiveHex, positiveNumber2); => BigInteger negativeNumber = -1000000; BigInteger positiveNumber = 15777216; String^ negativeHex = negativeNumber.ToString("X"); String^ positiveHex = positiveNumber.ToString("X"); BigInteger negativeNumber2, positiveNumber2; negativeNumber2 = BigInteger::Parse(negativeHex, NumberStyles.HexNumber); positiveNumber2 = BigInteger::Parse(positiveHex, NumberStyles.HexNumber); Console::WriteLine("Converted {0:N0} to {1} back to {2:N0}.", negativeNumber, negativeHex, negativeNumber2); Console::WriteLine("Converted {0:N0} to {1} back to {2:N0}.", positiveNumber, positiveHex, positiveNumber2); -- Greetings Jochen My blog about Win32 and .NET http://blog.kalmbachnet.de/
From: David Wilkinson on 19 Jan 2010 06:42 PvdG42 wrote: > > "GeorgCantor" <GeorgCantor(a)discussions.microsoft.com> wrote in message > news:5D42AABF-96E2-4E95-A537-3739C677C438(a)microsoft.com... >> One of the new additions to the .NET 4.0 framework is >> System.Numerics.BigInteger. >> >> Please can someone give a simple usage example? >> >> Thank you. >> > > I'm as frustrated as you are. After reading your post and the responses > you got, I thought "how hard could it be?" and now I'm stumped. So, > meaning no disrespect to anybody, I'm forwarding this to the C++/CLI > group to see what happens :-) If you are talking about the thread on the MSDN forum, then I confess that I incurred the wrath of the OP by refusing to answer his question, but simply pointed out that *if you know C++/CLI* then translating from C# is very easy, and is a skill one needs to learn. I then asked him what he had tried. However if you read the whole thread, I think you will find that the real problem is not that the OP does not know how to use BigInteger, but rather that he does not know anything about C++/CLI. If you are talking about the MSDN .NET documentation, it is regrettable that there are often no examples in C++/CLI, but that is just the way it is. Microsoft has given up on trying to make C++/CLI a first class citizen in ..NET-land. -- David Wilkinson Visual C++ MVP
From: PvdG42 on 19 Jan 2010 10:18 "Jochen Kalmbach [MVP]" <nospam-news(a)kalmbach-software.de> wrote in message news:eLUx6RNmKHA.1824(a)TK2MSFTNGP04.phx.gbl... > Hi PvdG42! > >>> Please can someone give a simple usage example? >> >> I'm as frustrated as you are. After reading your post and the responses >> you got, I thought "how hard could it be?" and now I'm stumped. So, >> meaning no disrespect to anybody, I'm forwarding this to the C++/CLI >> group to see what happens :-) > > What examples do you want to see? > It is no big problem to translate C# into C++/CLI... > > For example: > BigInteger negativeNumber = -1000000; > BigInteger positiveNumber = 15777216; > > string negativeHex = negativeNumber.ToString("X"); > string positiveHex = positiveNumber.ToString("X"); > > BigInteger negativeNumber2, positiveNumber2; > negativeNumber2 = BigInteger.Parse(negativeHex, > NumberStyles.HexNumber); > positiveNumber2 = BigInteger.Parse(positiveHex, > NumberStyles.HexNumber); > > Console.WriteLine("Converted {0:N0} to {1} back to {2:N0}.", > negativeNumber, negativeHex, negativeNumber2); > Console.WriteLine("Converted {0:N0} to {1} back to {2:N0}.", > positiveNumber, positiveHex, positiveNumber2); > > => > > BigInteger negativeNumber = -1000000; > BigInteger positiveNumber = 15777216; > > String^ negativeHex = negativeNumber.ToString("X"); > String^ positiveHex = positiveNumber.ToString("X"); > > BigInteger negativeNumber2, positiveNumber2; > negativeNumber2 = BigInteger::Parse(negativeHex, > NumberStyles.HexNumber); > positiveNumber2 = BigInteger::Parse(positiveHex, > NumberStyles.HexNumber); > > Console::WriteLine("Converted {0:N0} to {1} back to {2:N0}.", > negativeNumber, negativeHex, negativeNumber2); > Console::WriteLine("Converted {0:N0} to {1} back to {2:N0}.", > positiveNumber, positiveHex, positiveNumber2); > > -- > Greetings > Jochen > > My blog about Win32 and .NET > http://blog.kalmbachnet.de/ That's exactly the kind of thing I thought would work as a demo, and I appreciate your code. I also agree that translation from C# to C++/CLI for demos should be trivial. So, (in VS 2010 Premium b2 running on Win 7 x64) I created a C++/CLI console app, added: using namespace System::Numerics; then put some demo code you offered in main(), I get: "error C2039: 'Numerics': is not a member of 'System'" "error C2871: 'Numerics': a namespace with this name does not exist" I'm sure it's something my old brain has simply forgotten?
From: PvdG42 on 19 Jan 2010 10:25 "David Wilkinson" <no-reply(a)effisols.com> wrote in message news:#8WUsxPmKHA.5728(a)TK2MSFTNGP06.phx.gbl... > PvdG42 wrote: >> >> "GeorgCantor" <GeorgCantor(a)discussions.microsoft.com> wrote in message >> news:5D42AABF-96E2-4E95-A537-3739C677C438(a)microsoft.com... >>> One of the new additions to the .NET 4.0 framework is >>> System.Numerics.BigInteger. >>> >>> Please can someone give a simple usage example? >>> >>> Thank you. >>> >> >> I'm as frustrated as you are. After reading your post and the responses >> you got, I thought "how hard could it be?" and now I'm stumped. So, >> meaning no disrespect to anybody, I'm forwarding this to the C++/CLI >> group to see what happens :-) > > If you are talking about the thread on the MSDN forum, then I confess that > I > incurred the wrath of the OP by refusing to answer his question, but > simply > pointed out that *if you know C++/CLI* then translating from C# is very > easy, > and is a skill one needs to learn. I then asked him what he had tried. > > However if you read the whole thread, I think you will find that the real > problem is not that the OP does not know how to use BigInteger, but rather > that > he does not know anything about C++/CLI. > > If you are talking about the MSDN .NET documentation, it is regrettable > that > there are often no examples in C++/CLI, but that is just the way it is. > Microsoft has given up on trying to make C++/CLI a first class citizen in > .NET-land. > > -- > David Wilkinson > Visual C++ MVP Hi, David :-) No good deed goes unpunished, eh? I've been there many times. I was not aware of the extended thread. The thread I forwarded from was started by "GeorgCantor" in dotnet.framework, I thought more could be learned here, as it has. I fully agree that it's a shame the docs don't include more C++/CLI example code. I also agree that for demos, translation from C# should be easy. Anyway, thanks for your input!
From: Jochen Kalmbach [MVP] on 19 Jan 2010 11:00 Hi PvdG42! > "error C2039: 'Numerics': is not a member of 'System'" > "error C2871: 'Numerics': a namespace with this name does not exist" You either need to set the target-framework to .NET 4 or add the appropriate reference: - System.Numerics.dll -- Greetings Jochen My blog about Win32 and .NET http://blog.kalmbachnet.de/
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: "Add Webreference" in VS2008 .NET 2.0 project won't generate dynamiccode... Next: .NET Framework freezes the PC |