You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
parent
a569aebcfd
commit
e79aa3c0ed
@@ -0,0 +1,64 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="EarlyBoundInfo.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
// <owner current="true" primary="true">[....]</owner>
|
||||
// <owner current="false">[....]</owner>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
|
||||
namespace System.Xml.Xsl.Runtime {
|
||||
|
||||
/// <summary>
|
||||
/// This class contains information about early bound function objects.
|
||||
/// </summary>
|
||||
internal sealed class EarlyBoundInfo {
|
||||
private string namespaceUri; // Namespace Uri mapped to these early bound functions
|
||||
private ConstructorInfo constrInfo; // Constructor for the early bound function object
|
||||
|
||||
public EarlyBoundInfo(string namespaceUri, Type ebType) {
|
||||
Debug.Assert(namespaceUri != null && ebType != null);
|
||||
|
||||
// Get the default constructor
|
||||
this.namespaceUri = namespaceUri;
|
||||
this.constrInfo = ebType.GetConstructor(Type.EmptyTypes);
|
||||
Debug.Assert(this.constrInfo != null, "The early bound object type " + ebType.FullName + " must have a public default constructor");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the Namespace Uri mapped to these early bound functions.
|
||||
/// </summary>
|
||||
public string NamespaceUri { get { return this.namespaceUri; } }
|
||||
|
||||
/// <summary>
|
||||
/// Return the Clr Type of the early bound object.
|
||||
/// </summary>
|
||||
public Type EarlyBoundType { get { return this.constrInfo.DeclaringType; } }
|
||||
|
||||
/// <summary>
|
||||
/// Create an instance of the early bound object.
|
||||
/// </summary>
|
||||
public object CreateObject() { return this.constrInfo.Invoke(new object[] {}); }
|
||||
|
||||
/// <summary>
|
||||
/// Override Equals method so that EarlyBoundInfo to implement value comparison.
|
||||
/// </summary>
|
||||
public override bool Equals(object obj) {
|
||||
EarlyBoundInfo info = obj as EarlyBoundInfo;
|
||||
if (info == null)
|
||||
return false;
|
||||
|
||||
return this.namespaceUri == info.namespaceUri && this.constrInfo == info.constrInfo;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override GetHashCode since Equals is overriden.
|
||||
/// </summary>
|
||||
public override int GetHashCode() {
|
||||
return this.namespaceUri.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user