|
Hey Pete, I hope you don't mean
private int [][] avtomat = new int[maxState][30];
Because that is not C#!
Actually it's unclear what you really mean here, but if you interpret it as above you get the compiler error the OP quoted
|
|
|
|
|
Totally OffTopic but what does OP stands for?
I mean I know it has something to do with the person that posted the question/message
but what's OP from?
Object => hope and know not 
|
|
|
|
|
|
|
That's not what I meant. I was pointing out where the null reference was occuring. If you tried the example you quote here, you get an InvalidFieldSpecifier problem, not a null reference exception."WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Pete O'Hanlon wrote: That's not what I meant. I was pointing out where the null reference was occuring.
Ok, then IMO it's an odd way of pointing that out..
Pete O'Hanlon wrote: If you tried the example you quote here, you get an InvalidFieldSpecifier problem, not a null reference exception.
You'd get Invalid rank specifier: expected ',' or ']' as the OP also posted, which is exactly my point, if that had been what you meant, you would have given him invalid code. And from the OP's reaction, that is how what he understood your post to mean..
|
|
|
|
|
I didn't give him code - that was the whole point. He asked why he was getting a null reference exception; I told him. What he did next was up to him - without knowing what he was trying to achieve with it, I did not feel it was my place to suggest what he should do to resolve this and nowhere in my original answer did I suggest that he try to put a parameter to put into there. I will not be held responsible for somebody reading more into an answer than was there."WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
I don't think I agree Pete, your post looked a lot like "code with something you have to fill in" - it still looks that way to me, and going by his reaction it also looked that way to the OP.
But of course I'm not holding you responsible in any way (this is teh interwebs), I just tried (and failed, clearly) to point out how it would be confusing - you really don't need to get all defensive over it
So, my apologies.
|
|
|
|
|
I can see your point about why it looked that way, but it was never my intention to make it a "fill this bit in and it magically works". This is what I get when answering a post when juggling an installation onto 360 machines at the same time.
Perhaps I could have been clearer, but I'm not getting defensive on this - I was just trying to clarify that I knew this wasn't valid C#, and my answer wasn't intended to suggest it was. Next time I'll try not to be as "clever" with where I put the pointer to the problem."WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
It's because you now have an array of int[] , all of which are null. You have to create the sub-array's as well.
|
|
|
|
|
The Java rectangular array in your example is a special case in Java since Java only has jagged arrays (arrays of arrays), not multidimensional arrays, but allows a special rectangular jagged array initialization.
The C# equivalent to this is:
[code]//ORIGINAL LINE: private int[][] avtomat = new int[maxState][256];
//JAVA TO VB & C# CONVERTER NOTE: The following call to the 'RectangularArrays' helper class reproduces the rectangular array initialization that is automatic in Java:
private int[][] avtomat = RectangularArrays.ReturnRectangularIntArray(maxState, 256);
//----------------------------------------------------------------------------------------
// Copyright © 2008 - 2010 Tangible Software Solutions Inc.
// This class can be used by anyone provided that the copyright notice remains intact.
//
// This class provides the logic to simulate Java rectangular arrays, which are jagged
// arrays with inner arrays of the same length.
//----------------------------------------------------------------------------------------
internal static class RectangularArrays
{
internal static int[][] ReturnRectangularIntArray(int Size1, int Size2)
{
int[][] Array = new int[Size1][];
for (int Array1 = 0; Array1 < Size1; Array1++)
{
Array[Array1] = new int[Size2];
}
return Array;
}
}[/code]
David Anton
Convert between VB, C#, C++, & Java
www.tangiblesoftwaresolutions.com
|
|
|
|
|
Hi All
Do you know if it is possible to split a string in several lines in C#
In C++ I can write
std::cout << "this is a very "
"very very very "
"very very very "
"long string split into 4 lines that will be printed in one";
Do you know if I can do the same in C#?
Thanks
MN
|
|
|
|
|
Yes:
Console.WriteLine( "this is a very " +
"very very very " +
"very very very " +
"long string split into 4 lines that will be printed in one"); Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
|
|
|
|
|
Hi Thanks!
Is there any other way without the + char at the end?
For each + I think that C# due to how the String are will create
in memory a new object that is the result of "String1" + "String2".
I need just some facility so that compiler will recognize that it
must print on the same line.
This was the purpose of my questions even if I didn't make it explicit
|
|
|
|
|
Hi,
the C# compiler understands concatenation of string literals and executes them once, while compiling. It all results in one big string literal before your code actually gets executed, just the way you intended it. You could check with Reflector[^].
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
modified on Friday, February 26, 2010 12:57 PM
|
|
|
|
|
could try this
Console.WriteLine(@"this is a very
very very very
very very very
long string split into 4 lines that will be printed in one")
|
|
|
|
|
Thanks, but I need the string on the same line not on different lines.
When I have to print that I will see the new line I guess.
|
|
|
|
|
manustone wrote: I guess
Read the documentation; perform an experiment; don't guess.Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
Does anyone know why when I build a C# class library assembly that the meta file would contain any data? Is there some project setting I need to enable?
My class library has 6 classes, but when I open up the MyLibrary.dll.meta file it just says "No meta data found." This is a problem because then my main project -- about 300 source files and 100,000 lines of code -- wants to rebuild itself every time I make the smallest change to my library. The compiler gives me the message:
Cannot inspect MyLibrary.dll.meta. Assuming significant changes...
So if I change even one line of code in the library project, I have to sit here for several minutes while the main project rebuilds from scratch. What a waste of time!
Has anyone seen this before? How do I get the meta data file to properly populate when I build the library project?
P.S. -- Using Windows 7 64-bit (project set for 32-bit platforms), VS2008 with all service packs applied, and the same thing happens when I try to create a managed C++/CLI library as well. I can't get meta data to generate for any library in any language.
|
|
|
|
|
FYI... It looks like I resolved it by cleaning the solution and rebuilding everything. Now all my .dll.meta data file have metadata in them and I can't reproduce the problem when I make additional updates to the class library. Looks like a Visual Studio glitch.
|
|
|
|
|
Compute is one of the methods of DataTable class. This method computes an expression on the current rows that pass the filter criteria.
Syntax
Object DataTable.Compute(string expression , string filter)
Expression - The expression to compute.
Filter - The filter to limit the rows that evaluate in the expression.
This method's return type is System.Object. So, you have to cast it with appropriate data type.
The following operations can be passed through as expression parameter.
Sum -> Sum
Average -> Avg
Minimum -> Min
Maximum -> Max
Count -> Count
Statistical standard deviation ->StDev
Statistical variance -> Var
http://www.mindfiresolutions.com/DataTable-Compute-Method-628.php[^]Cheers,
Eliza
|
|
|
|
|
Congratulation, you are one of the few who have read the documentation.
Now, do you have an actual question? I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hey - don't knock it. It's the first time I can remember that someone's actually posted the answer to their homework instead of the question... You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
We don't do homework. Guessing what the question of the homework is, we don't do either.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
Hi all,
I am working on a Win32 application. We are enhancing it by creating some part of UI in .Net/WPF. Our core code is in C/C++ and some part of UI is in .Net/WPF. And We integrate these modules (C/C++ and .Net) via Managed C++.
Now I have to provide drag drop support. I need to drag some content from .Net UI and dropping it in C++/Win32 UI.
Can anybody help me knowing how to go about it?
Or let me know please how to implement drag drop from outside a .Net application (I mean drag from a .Net application and dropping outside it)
If some sample code or hyper-link can is there, please let me know.
Thanks and Regards
Aseem
|
|
|
|