Commit 4cd2af48 authored by Brickner_cp's avatar Brickner_cp

Warnings, Code Analysis and Documentation. 421 warnings left.

parent 7304ac50
...@@ -3,19 +3,42 @@ using System.Collections.Generic; ...@@ -3,19 +3,42 @@ using System.Collections.Generic;
namespace PcapDotNet.Base namespace PcapDotNet.Base
{ {
/// <summary>
/// An equality comparer that is implemented using the given equals and getHashCode functions.
/// </summary>
/// <typeparam name="T">The type of objects to compare.</typeparam>
public class InlineEqualityComparer<T> : IEqualityComparer<T> public class InlineEqualityComparer<T> : IEqualityComparer<T>
{ {
/// <summary>
/// Constructs the comparer using the given equals and getHashCode functions.
/// </summary>
/// <param name="equals">The function to use to implement Equals().</param>
/// <param name="getHashCode">The function to use to implement GetHashCode().</param>
public InlineEqualityComparer(Func<T, T, bool> equals, Func<T,int> getHashCode) public InlineEqualityComparer(Func<T, T, bool> equals, Func<T,int> getHashCode)
{ {
EqualsFunc = equals; EqualsFunc = equals;
GetHashCodeFunc = getHashCode; GetHashCodeFunc = getHashCode;
} }
/// <summary>
/// Determines whether the specified objects are equal using the equals function that was given in the constructor.
/// </summary>
/// <returns>
/// true if the specified objects are equal; otherwise, false.
/// </returns>
/// <param name="x">The first object of type <see cref="T:System.Object"/> to compare.</param><param name="y">The second object of type <see cref="T:System.Object"/> to compare.</param>
bool IEqualityComparer<T>.Equals(T x, T y) bool IEqualityComparer<T>.Equals(T x, T y)
{ {
return EqualsFunc(x, y); return EqualsFunc(x, y);
} }
/// <summary>
/// Returns a hash code for the specified object using the getHashCode function that was given in the constructor.
/// </summary>
/// <returns>
/// A hash code for the specified object.
/// </returns>
/// <param name="obj">The <see cref="T:System.Object"/> for which a hash code is to be returned.</param><exception cref="T:System.ArgumentNullException">The type of <paramref name="obj"/> is a reference type and <paramref name="obj"/> is null.</exception>
int IEqualityComparer<T>.GetHashCode(T obj) int IEqualityComparer<T>.GetHashCode(T obj)
{ {
return GetHashCodeFunc(obj); return GetHashCodeFunc(obj);
......
...@@ -2,6 +2,9 @@ using System; ...@@ -2,6 +2,9 @@ using System;
namespace PcapDotNet.Base namespace PcapDotNet.Base
{ {
/// <summary>
/// Useful functions for a sequence of objects.
/// </summary>
public static class Sequence public static class Sequence
{ {
public static int GetHashCode(object value1, object value2) public static int GetHashCode(object value1, object value2)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment