Skip to content

Commit c0c080e

Browse files
committed
Simplified code.
1 parent be7455a commit c0c080e

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

ReClass.NET/Memory/RemoteProcess.cs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,10 @@ public IEnumerable<Module> Modules
6161
{
6262
get
6363
{
64-
List<Module> cpy;
6564
lock (modules)
6665
{
67-
cpy = modules.ToList();
66+
return new List<Module>(modules);
6867
}
69-
return cpy;
7068
}
7169
}
7270

@@ -75,12 +73,10 @@ public IEnumerable<Section> Sections
7573
{
7674
get
7775
{
78-
List<Section> cpy;
7976
lock (sections)
8077
{
81-
cpy = sections.ToList();
78+
return new List<Section>(sections);
8279
}
83-
return cpy;
8480
}
8581
}
8682

@@ -568,20 +564,20 @@ public string GetNamedAddress(IntPtr address)
568564
return null;
569565
}
570566

571-
public bool EnumerateRemoteSectionsAndModules(out List<Section> sections, out List<Module> modules)
567+
public bool EnumerateRemoteSectionsAndModules(out List<Section> _sections, out List<Module> _modules)
572568
{
573569
if (!IsValid)
574570
{
575-
sections = null;
576-
modules = null;
571+
_sections = null;
572+
_modules = null;
577573

578574
return false;
579575
}
580576

581-
sections = new List<Section>();
582-
modules = new List<Module>();
577+
_sections = new List<Section>();
578+
_modules = new List<Module>();
583579

584-
coreFunctions.EnumerateRemoteSectionsAndModules(handle, sections.Add, modules.Add);
580+
coreFunctions.EnumerateRemoteSectionsAndModules(handle, _sections.Add, _modules.Add);
585581

586582
return true;
587583
}
@@ -600,11 +596,11 @@ public Task UpdateProcessInformationsAsync()
600596

601597
if (!IsValid)
602598
{
603-
lock(modules)
599+
lock (modules)
604600
{
605601
modules.Clear();
606602
}
607-
lock(sections)
603+
lock (sections)
608604
{
609605
sections.Clear();
610606
}

0 commit comments

Comments
 (0)