I have a Case, it is necessary to read. A method of cs file and will MethodA according to certain logical split into MethodB and MethodC respectively;
Currently using StreamReader. ReadLine () on. Cs file line by line to read; And reads the stored in each row of MethodA List
Please give some advice, how to make difference? Probably is completed (true... ) related code extracted into the MethodC, the rest of the completed (false... ) related in MethodB inside!
private void MethodA (DictionaryParam, Action Completed)
{
String ababab=string. The Empty;
Bool checkResult param of===null? False: param. Count & gt; 0? True, false;
DictionaryCommonParam=new Dictionary (a);
if (null !=param & amp; & Param. Values. The Count!=0 & amp; & Param. Either ContainsKey (" isAutoFreshFlag "))
{
CommonParam. Add (" isAutoFreshFlag ", true);
}
If (checkResult)
{
CommonParam. Add (" Test ", "Content");
Completed (true, commonParam);
}
The else
{
Completed, false, null);
}
}
Private bool MethodB (DictionaryParam)
{
String ababab=string. The Empty;
Bool checkResult param of===null? False: param. Count & gt; 0? True, false;
If (checkResult)
{
}
The else
{
return false;
}
//if (! CheckResult)
//{
//return false.
//}
return true;
}
Private DictionaryMethodC (Dictionary Param)
{
DictionaryCommonParam=new Dictionary (a);
if (null !=param & amp; & Param. Values. The Count!=0 & amp; & Param. Either ContainsKey (" isAutoFreshFlag "))
{
CommonParam. Add (" isAutoFreshFlag ", true);
}
CommonParam. Add (" Test ", "Content");
Return commonParam;
}
CodePudding user response:
to a great god did advise bai ~ I not understand - -,CodePudding user response:
Bring two copies of A code (red circle part) encapsulated into two methods, call the corresponding method B and C, respectively,CodePudding user response:
Using the CodeDOM | Microsoft Docshttps://docs.microsoft.com/en-us/dotnet/framework/reflection-and-codedom/using-the-codedom
CodePudding user response: