using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Serialization; namespace Utility
{
public class XMLHelper
{
#region object --> XML string.
public static string ToRequestXML<T>(T obj) where T : class
{
string xmlStr = string.Empty;
try
{
var type = typeof(T);
var properties = type.GetProperties();
XmlDocument xd = new XmlDocument();
XmlElement xe = xd.CreateElement("msgBody"); for (int i = ; i < properties.Length; i++)
{
var elementName = properties[i].Name; #region current type is List
if (properties[i].PropertyType.FullName.Contains("System.Collections.Generic.List"))
{
var propertyValue = properties[i].GetValue(obj, null);
if (propertyValue == null)
{
XmlElement xa = xd.CreateElement(elementName);
xe.AppendChild(xa);
}
else
{
xe = getArray(propertyValue, xe, xd, true, true, elementName);
}
continue;
}
#endregion #region current type is Array
if (properties[i].PropertyType.BaseType.Name == "Array")
{
var propertyName = properties[i].Name;
var propertyValue = properties[i].GetValue(obj, null);
if (propertyValue == null)
{
XmlElement xa = xd.CreateElement(elementName);
xe.AppendChild(xa);
}
else
{
xe = getArray(propertyValue, xe, xd, true, false, elementName);
}
continue;
}
#endregion #region current type is Model
if (properties[i].PropertyType.BaseType.Name != "Array" && (properties[i].PropertyType != typeof(long) && properties[i].PropertyType != typeof(int) && properties[i].PropertyType != typeof(string)) && !properties[i].PropertyType.FullName.Contains("System.Collections.Generic.List"))
{
var childPropertyName = properties[i].Name;
var childPropertyValue = properties[i].GetValue(obj, null); if (childPropertyValue == null)
{
var modelType = properties[i].PropertyType.UnderlyingSystemType;
var model = modelType.Assembly.CreateInstance(modelType.FullName);
xe = getArray(model, xe, xd, false, false, elementName);
}
else
{
xe = getArray(childPropertyValue, xe, xd, false, false, elementName);
}
continue;
}
#endregion #region current type is int or string
if (properties[i].PropertyType == typeof(long) || properties[i].PropertyType == typeof(string) || properties[i].PropertyType == typeof(int))
{
var childPropertyName = properties[i].Name;
var childPropertyValue = properties[i].GetValue(obj, null);
XmlElement xa = xd.CreateElement(childPropertyName);
if (childPropertyValue != null)
{
xa.InnerText = childPropertyValue.ToString();
}
else
{
xa.InnerText = "";
}
xe.AppendChild(xa);
continue;
}
#endregion
}
xd.AppendChild(xe);
xmlStr = xd.InnerXml;
return xmlStr;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion #region Get array value
private static XmlElement getArray(object propertyValue, XmlElement xe, XmlDocument xd, bool isArray, bool isList , string elementName)
{
try
{
if (propertyValue != null)
{
if (isList)
{
#region current type is Array
var array = propertyValue as System.Collections.IEnumerable;
if (array != null)
{
foreach (var item in array)
{
var obj = item;
var type = item.GetType();
var properties = type.GetProperties();
XmlElement childXe = xd.CreateElement(elementName);
for (int i = ; i < properties.Length; i++)
{
var propertyType = properties[i].PropertyType; #region current type is List
if (properties[i].PropertyType.FullName.Contains("System.Collections.Generic.List"))
{
var elementName2 = properties[i].Name;
var propertyValue2 = properties[i].GetValue(obj, null);
if (propertyValue2 == null)
{
XmlElement xa = xd.CreateElement(elementName);
childXe.AppendChild(xa);
}
else
{
childXe = getArray(propertyValue2, childXe, xd, true, true, elementName2);
}
continue;
}
#endregion #region current type is Array
if (properties[i].PropertyType.BaseType.Name == "Array")
{
var elementName2 = properties[i].Name;
var childPropertyValue = properties[i].GetValue(obj, null);
if (childPropertyValue == null)
{
XmlElement xa = xd.CreateElement(elementName);
childXe.AppendChild(xa);
}
else
{
childXe = getArray(childPropertyValue, childXe, xd, true, false, elementName2);
} }
#endregion #region current type is Model
if (properties[i].PropertyType.BaseType.Name != "Array" && (properties[i].PropertyType != typeof(long) && properties[i].PropertyType != typeof(int) && properties[i].PropertyType != typeof(string)) && !properties[i].PropertyType.FullName.Contains("System.Collections.Generic.List"))
{
elementName = properties[i].Name;
var childPropertyValue = properties[i].GetValue(obj, null);
if (childPropertyValue == null)
{
var modelType = type.UnderlyingSystemType;
var model = modelType.Assembly.CreateInstance(modelType.FullName);
xe = getArray(model, xe, xd, false, false, elementName);
}
else
{
childXe = getArray(childPropertyValue, childXe, xd, false, false, elementName);
}
}
#endregion #region current type is Number
if (properties[i].PropertyType == typeof(long) || properties[i].PropertyType == typeof(string) || properties[i].PropertyType == typeof(int))
{
var childPropertyName = properties[i].Name;
var childPropertyValue = properties[i].GetValue(obj, null);
XmlElement xa = xd.CreateElement(childPropertyName);
if (childPropertyValue != null)
{
xa.InnerText = childPropertyValue.ToString();
}
else
{
xa.InnerText = "";
}
childXe.AppendChild(xa);
}
#endregion
}
xe.AppendChild(childXe);
}
}
else
{
var list = (List<object>)propertyValue;
}
#endregion
return xe;
} if (isArray)
{
#region current type is Array
var array = (Array)propertyValue;
if (array != null)
{
for (int i = ; i < array.Length; i++)
{
var obj = array.GetValue(i);
var type = array.GetValue(i).GetType();
var properties = type.GetProperties();
XmlElement childXe = xd.CreateElement(elementName);
for (int j = ; j < properties.Length; j++)
{
var propertyType = properties[j].PropertyType; #region current type is List
if (properties[j].PropertyType.FullName.Contains("System.Collections.Generic.List"))
{
var elementName2 = properties[j].Name;
var propertyValue2 = properties[j].GetValue(obj, null);
if (propertyValue2 == null)
{
XmlElement xa = xd.CreateElement(elementName);
childXe.AppendChild(xa);
}
else
{
childXe = getArray(propertyValue2, childXe, xd, true, true, elementName2);
}
continue;
}
#endregion #region current type is Array
if (properties[j].PropertyType.BaseType.Name == "Array")
{
var elementName2 = properties[j].Name;
var childPropertyValue = properties[j].GetValue(obj, null);
if (childPropertyValue == null)
{
XmlElement xa = xd.CreateElement(elementName);
childXe.AppendChild(xa);
}
else
{
childXe = getArray(childPropertyValue, childXe, xd, true, false, elementName2);
} }
#endregion #region current type is Model
if (properties[j].PropertyType.BaseType.Name != "Array" && (properties[j].PropertyType != typeof(long) && properties[j].PropertyType != typeof(int) && properties[j].PropertyType != typeof(string)))
{
elementName = properties[j].Name;
var childPropertyValue = properties[j].GetValue(obj, null);
if (childPropertyValue == null)
{
var modelType = properties[i].PropertyType.UnderlyingSystemType;
var model = modelType.Assembly.CreateInstance(modelType.FullName);
xe = getArray(model, xe, xd, false, false, elementName);
}
else
{
childXe = getArray(childPropertyValue, childXe, xd, false, false, elementName);
}
}
#endregion #region current type is Number
if (properties[j].PropertyType == typeof(long) || properties[j].PropertyType == typeof(string) || properties[j].PropertyType == typeof(int))
{
var childPropertyName = properties[j].Name;
var childPropertyValue = properties[j].GetValue(obj, null);
XmlElement xa = xd.CreateElement(childPropertyName);
if (childPropertyValue != null)
{
xa.InnerText = childPropertyValue.ToString();
}
else
{
xa.InnerText = "";
}
childXe.AppendChild(xa);
}
#endregion
}
xe.AppendChild(childXe);
}
}
else
{
var list = (List<object>)propertyValue;
}
#endregion
}
else
{
#region current type isn't Array
var objType = propertyValue.GetType();
var properties = objType.GetProperties();
XmlElement childXe = xd.CreateElement(elementName);
for (int j = ; j < properties.Length; j++)
{
var propertyType = properties[j].PropertyType; #region current type is Array
if (properties[j].PropertyType.BaseType.Name == "Array")
{
var elementName2 = properties[j].Name;
var childPropertyValue = properties[j].GetValue(propertyValue, null);
if (childPropertyValue == null)
{
XmlElement xa = xd.CreateElement(elementName);
childXe.AppendChild(xa);
}
else
{
childXe = getArray(childPropertyValue, childXe, xd, true, false, elementName2);
}
}
#endregion #region current type is Model
if (properties[j].PropertyType.BaseType.Name != "Array" && (properties[j].PropertyType != typeof(long) && properties[j].PropertyType != typeof(int) && properties[j].PropertyType != typeof(string)))
{
elementName = properties[j].Name;
var childPropertyValue = properties[j].GetValue(propertyValue, null);
if (childPropertyValue == null)
{
var modelType = properties[j].PropertyType.UnderlyingSystemType;
var model = modelType.Assembly.CreateInstance(modelType.FullName);
xe = getArray(model, xe, xd, false, false, elementName);
}
else
{
childXe = getArray(childPropertyValue, childXe, xd, false, false, elementName);
}
}
#endregion #region current is Number
if (properties[j].PropertyType == typeof(long) || properties[j].PropertyType == typeof(string) || properties[j].PropertyType == typeof(int))
{
var childPropertyName = properties[j].Name;
var childPropertyValue = properties[j].GetValue(propertyValue, null);
XmlElement xa = xd.CreateElement(childPropertyName);
if (childPropertyValue != null)
{
xa.InnerText = childPropertyValue.ToString();
}
else
{
xa.InnerText = "";
}
childXe.AppendChild(xa);
}
#endregion
}
xe.AppendChild(childXe);
#endregion
}
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
return xe;
}
#endregion #region XML string --> object
/// <summary>
/// Convert xml message to object
/// </summary>
/// <param name="type"></param>
/// <param name="xmlStr"></param>
/// <returns></returns>
public static T ToResponseObject<T>(string xmlStr) where T : new()
{
try
{
//T obj = default(T);
T obj = new T();
var repType = typeof(T);
XmlDocument document = new XmlDocument();
document.LoadXml(xmlStr); //加载Xml文件
XmlElement node = document.DocumentElement; //xml的根标签
var nodeList = document.ChildNodes;
var properties = repType.GetProperties(); foreach (var itemProp in properties)
{
#region current type is List
if (itemProp.PropertyType.FullName.Contains("System.Collections.Generic.List"))
{ object array = new object();
var arryLength = ;
var notNullLength = ;
var arryType = itemProp.PropertyType.UnderlyingSystemType; var objList = itemProp.GetValue(obj, null) as System.Collections.IEnumerable;
var enumt = objList.GetEnumerator();
//enumt.
var currentType = itemProp.PropertyType.GetGenericArguments()[]; foreach (XmlNode xmlitem in node.ChildNodes)
{
if (xmlitem.Name == itemProp.Name)
{
arryLength++;
}
}
if (arryLength > )
{
var arrayModel = arryType.InvokeMember("Set", System.Reflection.BindingFlags.CreateInstance, null, array, new object[] { arryLength }) as System.Collections.IList;
foreach (XmlNode item in node.ChildNodes)
{
//current type is array
if (item.Name == itemProp.Name)
{
var model = currentType.Assembly.CreateInstance(currentType.FullName); // arryType.GetElementType().Assembly.CreateInstance(currentType.FullName);
SetArray(item.ChildNodes, model,true);
arrayModel.Add(model);
//arrayModel[notNullLength] = model;
notNullLength++;
}
}
itemProp.SetValue(obj, arrayModel, null);
} continue;
}
#endregion var baseType = itemProp.PropertyType.BaseType.Name;
if (baseType == "Array")
{
#region Current type is Array
object array = new object();
var arryLength = ;
var notNullLength = ;
var arryType = itemProp.PropertyType.UnderlyingSystemType;
foreach (XmlNode xmlitem in node.ChildNodes)
{
if (xmlitem.Name == itemProp.Name)
{
arryLength++;
}
}
if (arryLength > )
{
var arrayModel = arryType.InvokeMember("Set", System.Reflection.BindingFlags.CreateInstance, null, array, new object[] { arryLength }) as System.Collections.IList;
foreach (XmlNode item in node.ChildNodes)
{
//current type is array
if (item.Name == itemProp.Name)
{
var model = arryType.GetElementType().Assembly.CreateInstance(arryType.GetElementType().FullName);
SetArray(item.ChildNodes, model);
arrayModel[notNullLength] = model;
notNullLength++;
}
}
itemProp.SetValue(obj, arrayModel, null);
}
#endregion continue;
}
else
{
#region Current type isn't Array
foreach (XmlNode item in node.ChildNodes)
{
#region Current type is Number
if (itemProp.Name == item.Name && (itemProp.PropertyType == typeof(long) || itemProp.PropertyType == typeof(int) || itemProp.PropertyType == typeof(string)))
{
if (itemProp.PropertyType == typeof(int) || itemProp.PropertyType == typeof(long))
{
if (!string.IsNullOrEmpty(item.InnerText))
{
if (itemProp.PropertyType == typeof(int))
{
itemProp.SetValue(obj, Convert.ToInt32(item.InnerText), null);
}
else
{
itemProp.SetValue(obj, Convert.ToInt64(item.InnerText), null);
} }
else
{
itemProp.SetValue(obj, , null);
}
}
else
{
itemProp.SetValue(obj, item.InnerText, null);
}
}
#endregion #region Current type is Model
if (itemProp.PropertyType != typeof(long) && itemProp.PropertyType != typeof(string) && itemProp.PropertyType != typeof(int) && itemProp.PropertyType.Name == item.Name && item.HasChildNodes && item.FirstChild.NodeType == System.Xml.XmlNodeType.Element)
{
var modelType = itemProp.PropertyType.UnderlyingSystemType;
var model = modelType.Assembly.CreateInstance(modelType.FullName);
SetArray(item.ChildNodes, model);
itemProp.SetValue(obj, model, null);
}
#endregion
}
#endregion continue;
}
}
repType = obj.GetType();
return obj;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion #region Set array value
private static Object SetArray(XmlNodeList xmlNodeList, object obj,bool isList = false)
{
try
{
var type = obj.GetType();
var properties = type.GetProperties();
foreach (var itemProp in properties)
{
//if (isList)
if (itemProp.PropertyType.FullName.Contains("System.Collections.Generic.List"))
{
#region Current type is List
object array = new object();
var arryLength = ;
var notNullLength = ;
var arryType = itemProp.PropertyType.UnderlyingSystemType;
var currentType = itemProp.PropertyType.GetGenericArguments()[];
foreach (XmlNode xmlitem in xmlNodeList)
{
if (xmlitem.Name == itemProp.Name)
{
arryLength++;
}
} if (arryLength > )
{
var arrayModel = arryType.InvokeMember("Set", System.Reflection.BindingFlags.CreateInstance, null, array, new object[] { arryLength }) as System.Collections.IList;
foreach (XmlNode item in xmlNodeList)
{
//current type is array
if (item.Name == itemProp.Name)
{
var model = currentType.Assembly.CreateInstance(currentType.FullName); // var model = arryType.GetElementType().Assembly.CreateInstance(arryType.GetElementType().FullName);
SetArray(item.ChildNodes, model,true);
arrayModel.Add(model);
notNullLength++; }
}
itemProp.SetValue(obj, arrayModel, null);
}
#endregion
return obj;
} var baseType = itemProp.PropertyType.BaseType.Name;
if (baseType == "Array")
{
#region Current type is Array
object array = new object();
var arryLength = ;
var notNullLength = ;
var arryType = itemProp.PropertyType.UnderlyingSystemType;
foreach (XmlNode xmlitem in xmlNodeList)
{
if (xmlitem.Name == itemProp.Name)
{
arryLength++;
}
} if (arryLength > )
{
var arrayModel = arryType.InvokeMember("Set", System.Reflection.BindingFlags.CreateInstance, null, array, new object[] { arryLength }) as System.Collections.IList;
foreach (XmlNode item in xmlNodeList)
{
//current type is array
if (item.Name == itemProp.Name)
{
var model = arryType.GetElementType().Assembly.CreateInstance(arryType.GetElementType().FullName);
SetArray(item.ChildNodes, model);
arrayModel[notNullLength] = model;
notNullLength++; }
}
itemProp.SetValue(obj, arrayModel, null);
}
#endregion
}
else
{
foreach (XmlNode item in xmlNodeList)
{
#region Current type is Number
if (itemProp.Name == item.Name && (itemProp.PropertyType == typeof(long) || itemProp.PropertyType == typeof(int) || itemProp.PropertyType ==typeof(string)))
{
if (itemProp.PropertyType== typeof(int) || itemProp.PropertyType== typeof(long))
{
if (!string.IsNullOrEmpty(item.InnerText))
{
if (itemProp.PropertyType == typeof(int))
{
itemProp.SetValue(obj, Convert.ToInt32(item.InnerText), null);
}
else
{
itemProp.SetValue(obj, Convert.ToInt64(item.InnerText), null);
}
}
else
{
itemProp.SetValue(obj, , null);
}
}
else
{
itemProp.SetValue(obj, item.InnerText, null);
}
}
#endregion #region Current type is Model
if (itemProp.PropertyType != typeof(long) && itemProp.PropertyType != typeof(int) && itemProp.PropertyType != typeof(string) && itemProp.PropertyType.Name == item.Name && item.HasChildNodes && item.FirstChild.NodeType == System.Xml.XmlNodeType.Element)
{
var modelType = itemProp.PropertyType.UnderlyingSystemType;
var model = modelType.Assembly.CreateInstance(modelType.FullName);
SetArray(item.ChildNodes, model);
itemProp.SetValue(obj, model, null);
}
#endregion
}
}
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
return obj;
}
#endregion
} public class XMLNew
{
public static void ToXML()
{
try
{
TestA testA = new TestA();
List<TestC> testCList = new List<TestC>();
List<TestB> testBList = new List<TestB>();
List<TestD> testDList = new List<TestD>(); TestB testB = new TestB();
TestC testC = new TestC();
TestD testD = new TestD(); testCList.Add(testC);
testCList.Add(testC);
testBList.Add(testB);
testBList.Add(testB);
testDList.Add(testD);
testDList.Add(testD); testC.TestDArray = testDList.ToArray();
//testC.TestDList = testDList; //testB.TestCList = testCList;
testB.TestCArray = testCList.ToArray(); testA.TestBArray = testBList.ToArray();
//testA.TestBList = testBList; //string rqstXmlBody = Server.DataAccess.CallServerHelper.ToRequestXML<TestA>(testA);
string xml = Utility.XMLHelper.ToRequestXML<TestA>(testA); var obj = Utility.XMLHelper.ToResponseObject<TestA>(xml);
//var obj2 = Server.DataAccess.CallServerHelper.ToResponseObject<TestA>(rqstXmlBody);
}
catch (Exception ex)
{
//MessageHelper.Error(ex.Message);
}
}
} [Serializable]
public class TestD
{
public TestD()
{
D1 = "D1";
D2 = "D2";
}
public string D1 { get; set; }
public string D2 { get; set; }
} [Serializable]
public class TestC
{
public TestC()
{
C1 = "C1";
C2 = "C2";
}
public string C1 { get; set; }
public string C2 { get; set; } public TestD[] TestDArray { get; set; }
//public List<TestD> TestDList { get; set; }
} [Serializable]
public class TestB
{
public TestB()
{
//TestCList = new List<TestC>();
B1 = "B1";
B2 = "B2";
} public string B1 { get; set; }
public string B2 { get; set; } public TestC[] TestCArray { get; set; }
//public List<TestC> TestCList { get; set; }
} [Serializable]
public class TestA
{
public string A1 { get; set; }
public string A2 { get; set; }
public TestA()
{
//TestBList = new List<TestB>();
A1 = "A1";
A2 = "A2";
}
public TestB[] TestBArray { get; set; }
//public List<TestB> TestBList { get; set; }
} }

C#_XML与Object转换的更多相关文章

  1. 用于把List<Object>转换成Map<String,Object>形式

    /** * 用于把List<Object>转换成Map<String,Object>形式,便于存入缓存 * @author zhang_bo * @param keyName ...

  2. java Object转换成指定的类型

    java Object转换成指定的类型 /** * Object转成指定的类型 * @param obj * @param type * @param <T> * @return */ p ...

  3. LINQ系列:Linq to Object转换操作符

    转换是指将输入对象的类型转变为序列的动作. 1. AsEnumerable AsEnumerable操作符将查询的输入以IEnumberable(T)类型返回. 2. Cast Cast操作符将IEn ...

  4. C#如何把List of Object转换成List of T具体类型

    上周码程序的时候碰到个问题,因为设计上的约束,一个方法接受的参数只能为List<object>类型,然而该方法需要处理的真实数据则是确定的List<Currency>.然而C# ...

  5. 匿名类型和Object转换

    本文转载:http://www.cnblogs.com/JustRun1983/archive/2012/05/13/2497997.html net中的匿名类型非常好用, 但是开发中遇到一个问题,当 ...

  6. java中Object转换成int或String类型方法

    转载: http://www.cnblogs.com/1020182600HENG/p/6137206.html Object obj = getObject(); if(obj instanceof ...

  7. 将Object转换成Dictionary方法

    如果Object是Dictionary类型,直接返回 如果Object是NameValueCollection类型,则添加到Dictionary里 如果Object是Hashtable类型,添加到Di ...

  8. 将[object Object]转换成json对象

    这两天在做中英文双版的文件,页面根据语言读取不同的内容.js模板用的是ejs json文件: "components":{ "pages":{ "ho ...

  9. 将object转换成dyamic类型 解决long输出到浏览器过长精度丢失问题

    需求: 数据库使用飘雪算法保存唯一标识  是一个18位长整形 将数据输出到浏览器时出现了精度丢失问题,这是一个重大的BUG.如果没解决好整个项目都要改一遍. 讨论有三个办法 1.把所有实体 数据模型的 ...

随机推荐

  1. [20171113]修改表结构删除列相关问题4.txt

    [20171113]修改表结构删除列相关问题4.txt --//连续写了3篇修改表结构删除列的相关问题,链接如下: http://blog.itpub.net/267265/viewspace-214 ...

  2. 让bootstrap-table支持高度百分比

    更改BootstrapTable.prototype.resetView 方法,以支持高度百分比定义,适应不同高度屏幕 BootstrapTable.prototype.resetView = fun ...

  3. Linux远程访问及控制(SSH)

    1.ssh协议:用于远程登录,端口号:22/tcp 配置文件: 1)服务器端口:/etc/ssh/sshd_config 2)客户端 :/etc/ssh/ssh_config 2.服务器监听选项: U ...

  4. Linux 小知识翻译 - 「端口限制」

    上次说了端口号相关的内容,这次聊聊「端口限制」的事. 经常看到关于安全的书籍上会说「不要开放多余的端口」,那么,如何限制端口才好呢? 实际,端口限制的方法大体上分的话有2种. 其一,「通过应用程序来处 ...

  5. python五十七课——正则表达式(多个字符)

    演示匹配多个字符:以下x.y.n都是变量名:分类:1).模糊匹配: x?:表示0个或者1个 取值范围:[0,1]x+:表示1个或者多个 取值范围:[1,无穷大)x*:表示0个或者多个 取值范围:[0, ...

  6. php7 教程

    标量类型声明 1. 分为强制模式和严格模式 2. 这些类型的函数参数可以执行声明 int, float, bool, string, interfaces, array, callable 例如: f ...

  7. Qt中静态变量使用方法

    静态变量可以在各个页面之前使用 先定义一个用于存放静态变量的类 例如datavar 在datavar.h中添加如下代码 #ifndef DATAVAR_H #define DATAVAR_H #inc ...

  8. [转]系统架构演变--集中式架构-垂直拆分-分布式服务-SOA(服务治理)-微服务

    一.系统架构演变 1.1. 集中式架构 当网站流量很小时,只需一个应用,将所有功能都部署在一起,以减少部署节点和成本.此时,用于简化增删改查工作量的数据访问框架(ORM)是影响项目开发的关键. 存在的 ...

  9. 恶意软件的bypass

    导读 在网络安全的背景下,尽管存在反恶意软件控制,但逃避是执行恶意代码的做法.这种策略不会利用可修复的缺陷.相反,他们利用阻止现实世界中恶意软件检测的因素来实现其完整的理论潜力. 恶意软件这些逃避因素 ...

  10. PAT A1155 Heap Paths (30 分)——完全二叉树,层序遍历,特定dfs遍历

    In computer science, a heap is a specialized tree-based data structure that satisfies the heap prope ...