| | |
| | | public static T CodeAnalysis<T>(AnalysisCode analysisCode, string code) |
| | | { |
| | | Type type = typeof(T); |
| | | T result = (T)Activator.CreateInstance(type); |
| | | object? obj = Activator.CreateInstance(type); |
| | | if (obj == null) |
| | | throw new Exception("å®ä¾å对象é误"); |
| | | T result = (T)obj; |
| | | try |
| | | { |
| | | AnalysisRuleAttribute? analysisRule = type.GetCustomAttribute<AnalysisRuleAttribute>(); |
| | |
| | | AnalysisItemRuleAttribute? analysisItemRule = propertyInfo.GetCustomAttribute<AnalysisItemRuleAttribute>(); |
| | | if (analysisItemRule != null) |
| | | { |
| | | if(analysisItemRule.AnalysisFormaType == AnalysisFormaType.BD) |
| | | if(analysisItemRule.AnalysisFormaType == AnalysisFormatType.BD) |
| | | { |
| | | propertyInfo.SetValue(result, code.ChangeType(propertyInfo.PropertyType)); |
| | | } |