优化代码结构的技巧 [英] Tips to optimize code structure

查看:99
本文介绍了优化代码结构的技巧的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我需要一些有关优化代码的建议.在项目中,结构非常复杂,我想优化代码以删除重复的代码.
->我有一个解决方案文件,在那个解决方案文件中,我有4个项目.
->在3个项目中,有一个包含通用代码,或者我可以说优化代码
->现在的问题就像我要优化剩余的代码,但是引用了每个项目具有不同版本的dll.
->项目具有代码结构,例如在每个项目中都包含部分类,并且每个项目中的代码都有些相似.

Hello Everyone,

I need some suggestions regarding optimizing the code. In project the structure is quite complicated and i want to optimize the code removing the repeated code.
-> I have one solution file and in that solution file i have 4 projects. 
-> Out of 3 one project contains the common code or i can say the optimized code
-> Now the problem is like i want to optimize the remaining code but the refers some dll which is having different version for each project.
- > Project has code structure like it contains partial class in each project and the code is somewhat similar in each project.

有人可以指导我如何进一步优化这种代码结构.

提前致谢 

推荐答案

您好,BizTalkDeveloper2016,

Hi BizTalkDeveloper2016,

感谢您在此处发布.

根据您的描述,这三个项目包含通用代码,并引用了每个项目具有不同版本的一些dll.您想优化代码结构.

您可以从三个项目中使用的代码将所有版本中使用的代码转移到一个新类中.并在三个项目中调用该类.然后你可以使用 委托可以简化每个项目中的代码.

希望对您有所帮助.

最好的问候,

Thank you for posting here.

According to your description, the three project contains the common code and refers some dlls which has different versions for each project. And you want to optimize code structure.

You could take the code from three projects which could be used in all the versions out to a new class. And invoke the class in three projects. And then you could use Delegate to simplify the code in each project.

I hope this would be helpful to you. 

Best regards,

温迪


这篇关于优化代码结构的技巧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆