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.
254
|
Chapter 4: Generics
throw new ArgumentException(
"Argument passed is of wrong type", "value");
}
}
#endregion // Private methods
#region Public Properties
public int Capacity
{
get
{
return this.keys.Length;
}
set
{
this.InternalSetCapacity(value, true);
}
}
public SortDirectionComparer<TKey> Comparer
{
get
{
return this._sortDirectionComparer;
}
}
public int Count
{
get
{
return this._size;
}
}
public TValue this[TKey key]
{
get
{
TValue local1;
int num1 = this.IndexOfKey(key);
if (num1 >= 0)
{
return this.values[num1];
}
else
{
//throw new KeyNotFoundException( );
local1 = default(TValue);
return local1;
}
}
Example 4-3. ReversibleSortedList class (continued)
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Reversing the Contents of a Sorted List
|
255
set
{
if (key == null)
{
throw new ArgumentNullException("key");
}
int num1 = Array.BinarySearch<TKey>(this.keys, 0, this._size, key,
this._sortDirectionComparer);
if (num1 >= 0)
{
this.values[num1] = value;
this.version++;
}
else
{
this.Insert(~num1, key, value);
}
}
}
public IList<TKey> Keys
{
get
{
return this.GetKeyListHelper( );
}
}
public IList<TValue> ...
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