⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 graphdataattribute.cs

📁 英语句子自然语言处理统计分析例子 Statistical parsing of English sentences Shows how to generate parse trees for
💻 CS
字号:

using System;
using System.Collections;
using System.Reflection;

namespace Netron.Lithium
{
	/// <summary>
	/// Attribute class for designating which properties will be serialized
	/// by the GraphML serializer.
	/// </summary>
	/// 
	[AttributeUsage(AttributeTargets.Property,AllowMultiple = false)]
	public class GraphDataAttribute : System.Attribute
	{
		#region Delegates
		private delegate void ToStringDelegate();
		private delegate void FromStringDelegate();
		#endregion
		
		/// <summary>
		/// Returns the tagged properties of the gibven object
		/// </summary>
		/// <param name="value">whatever class</param>
		/// <returns>a hashtable of property names with their values</returns>
		public static Hashtable GetValuesOfTaggedFields(object value) 
		{
			Hashtable vs = new Hashtable();

			foreach (PropertyInfo pi in value.GetType().GetProperties()) 
			{	
				if (Attribute.IsDefined(pi, typeof(GraphDataAttribute))) 
				{
					vs.Add(pi.Name,pi.GetValue(value,null));
				}
			}

			return vs;
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -