Skip to Main Content
C# Cookbook, 2nd Edition
book

C# Cookbook, 2nd Edition

by Jay Hilyard, Stephen Teilhet
January 2006
Intermediate to advanced content levelIntermediate to advanced
1184 pages
43h 23m
English
O'Reilly Media, Inc.
Content preview from C# Cookbook, 2nd Edition
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Writing a More Flexible StackTrace Class
|
289
This method displays the following:
1
2
3
10
11
12
13
14
15
3 The first reversed subarray
2
1
15 The second reversed subarray
14
13
12
11
10
The logic used to reverse each subarray of a jagged array is very similar to the rever-
sal logic discussed in the previous recipe. The
ReverseJaggedArray<T> method uses
the same basic logic presented in Recipe 5.2 to reverse each element in the array;
however, a nested
for loop is used instead of a single for loop. The outer for loop
iterates over each element of the first dimensioned array of the jagged array (there are
two elements in this array). The inner
for loop is used to iterate over each element
contained within the second dimensioned array of the jagged array. The reverse logic
is then applied to the elements handled by the inner
for loop. This allows each array
contained by the first dimensioned array in the jagged array to be reversed.
See Also
See Recipes 5.2 and 5.3.
5.5 Writing a More Flexible StackTrace Class
Problem
You have a StackTrace object that contains a listing of stack frames. You need to iter-
ate through these stack frames as if you were using a
Collection-type object.
Solution
Wrap the public interface of a StackTrace object to look like a Collection-type
object. The
StackTraceList class shown
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C# Cookbook

C# Cookbook

Stephen Teilhet, Jay Hilyard
C# Cookbook

C# Cookbook

Joe Mayo
Head First C#, 4th Edition

Head First C#, 4th Edition

Andrew Stellman, Jennifer Greene

Publisher Resources

ISBN: 0596100639Supplemental ContentCatalog PageErrata