How to rewrite my code? [closed]












-5














I'm a new programmer,I write some code just now.
yet it looks like not professional and effective.



How to rewrite it?



for (int i = 0; i < p.Count; i++)
{
if (findedPoints.Contains(p[i])) continue;

first = FindNextPoint(p, p[i], findedPoints);
Stack<Point> pointsToFind = new Stack<Point>();
for (int j = 0; j < first.Count; j++)
{
pointsToFind.Push(first[j]);
}

findedPoints.AddRange(first);
Point point = pointsToFind.Pop();
while (point != Point.Empty)
{
List<Point> list = FindNextPoint(p, point, findedPoints);
for (int j = 0; j < list.Count; j++)
{
pointsToFind.Push(list[j]);
}

point = pointsToFind.Count > 0 ? pointsToFind.Pop() : Point.Empty;
first.AddRange(list);
findedPoints.AddRange(list);
}

if (first.Count <= 0) continue;

Point item = (Point)first.ToArray().Clone();

areas.Add(item.ToList());
first.Clear();
}


I want to get it looks like a professional block.










share|improve this question







New contributor




new programmer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











closed as off-topic by πάντα ῥεῖ, Mast, t3chb0t, Greg Burghardt, Denis Dec 16 at 12:33


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Lacks concrete context: Code Review requires concrete code from a project, with sufficient context for reviewers to understand how that code is used. Pseudocode, stub code, hypothetical code, obfuscated code, and generic best practices are outside the scope of this site." – πάντα ῥεῖ, Mast, t3chb0t, Greg Burghardt, Denis

If this question can be reworded to fit the rules in the help center, please edit the question.









  • 4




    First, you need to rewrite your question so that it states what your code is accomplishing and if necessary then also how and why. You want your code look professional? Start with the question look like that ;-)
    – t3chb0t
    Dec 16 at 11:44


















-5














I'm a new programmer,I write some code just now.
yet it looks like not professional and effective.



How to rewrite it?



for (int i = 0; i < p.Count; i++)
{
if (findedPoints.Contains(p[i])) continue;

first = FindNextPoint(p, p[i], findedPoints);
Stack<Point> pointsToFind = new Stack<Point>();
for (int j = 0; j < first.Count; j++)
{
pointsToFind.Push(first[j]);
}

findedPoints.AddRange(first);
Point point = pointsToFind.Pop();
while (point != Point.Empty)
{
List<Point> list = FindNextPoint(p, point, findedPoints);
for (int j = 0; j < list.Count; j++)
{
pointsToFind.Push(list[j]);
}

point = pointsToFind.Count > 0 ? pointsToFind.Pop() : Point.Empty;
first.AddRange(list);
findedPoints.AddRange(list);
}

if (first.Count <= 0) continue;

Point item = (Point)first.ToArray().Clone();

areas.Add(item.ToList());
first.Clear();
}


I want to get it looks like a professional block.










share|improve this question







New contributor




new programmer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











closed as off-topic by πάντα ῥεῖ, Mast, t3chb0t, Greg Burghardt, Denis Dec 16 at 12:33


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Lacks concrete context: Code Review requires concrete code from a project, with sufficient context for reviewers to understand how that code is used. Pseudocode, stub code, hypothetical code, obfuscated code, and generic best practices are outside the scope of this site." – πάντα ῥεῖ, Mast, t3chb0t, Greg Burghardt, Denis

If this question can be reworded to fit the rules in the help center, please edit the question.









  • 4




    First, you need to rewrite your question so that it states what your code is accomplishing and if necessary then also how and why. You want your code look professional? Start with the question look like that ;-)
    – t3chb0t
    Dec 16 at 11:44
















-5












-5








-5







I'm a new programmer,I write some code just now.
yet it looks like not professional and effective.



How to rewrite it?



for (int i = 0; i < p.Count; i++)
{
if (findedPoints.Contains(p[i])) continue;

first = FindNextPoint(p, p[i], findedPoints);
Stack<Point> pointsToFind = new Stack<Point>();
for (int j = 0; j < first.Count; j++)
{
pointsToFind.Push(first[j]);
}

findedPoints.AddRange(first);
Point point = pointsToFind.Pop();
while (point != Point.Empty)
{
List<Point> list = FindNextPoint(p, point, findedPoints);
for (int j = 0; j < list.Count; j++)
{
pointsToFind.Push(list[j]);
}

point = pointsToFind.Count > 0 ? pointsToFind.Pop() : Point.Empty;
first.AddRange(list);
findedPoints.AddRange(list);
}

if (first.Count <= 0) continue;

Point item = (Point)first.ToArray().Clone();

areas.Add(item.ToList());
first.Clear();
}


I want to get it looks like a professional block.










share|improve this question







New contributor




new programmer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I'm a new programmer,I write some code just now.
yet it looks like not professional and effective.



How to rewrite it?



for (int i = 0; i < p.Count; i++)
{
if (findedPoints.Contains(p[i])) continue;

first = FindNextPoint(p, p[i], findedPoints);
Stack<Point> pointsToFind = new Stack<Point>();
for (int j = 0; j < first.Count; j++)
{
pointsToFind.Push(first[j]);
}

findedPoints.AddRange(first);
Point point = pointsToFind.Pop();
while (point != Point.Empty)
{
List<Point> list = FindNextPoint(p, point, findedPoints);
for (int j = 0; j < list.Count; j++)
{
pointsToFind.Push(list[j]);
}

point = pointsToFind.Count > 0 ? pointsToFind.Pop() : Point.Empty;
first.AddRange(list);
findedPoints.AddRange(list);
}

if (first.Count <= 0) continue;

Point item = (Point)first.ToArray().Clone();

areas.Add(item.ToList());
first.Clear();
}


I want to get it looks like a professional block.







c# .net






share|improve this question







New contributor




new programmer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




new programmer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




new programmer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Dec 16 at 11:24









new programmer

1




1




New contributor




new programmer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





new programmer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






new programmer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




closed as off-topic by πάντα ῥεῖ, Mast, t3chb0t, Greg Burghardt, Denis Dec 16 at 12:33


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Lacks concrete context: Code Review requires concrete code from a project, with sufficient context for reviewers to understand how that code is used. Pseudocode, stub code, hypothetical code, obfuscated code, and generic best practices are outside the scope of this site." – πάντα ῥεῖ, Mast, t3chb0t, Greg Burghardt, Denis

If this question can be reworded to fit the rules in the help center, please edit the question.




closed as off-topic by πάντα ῥεῖ, Mast, t3chb0t, Greg Burghardt, Denis Dec 16 at 12:33


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Lacks concrete context: Code Review requires concrete code from a project, with sufficient context for reviewers to understand how that code is used. Pseudocode, stub code, hypothetical code, obfuscated code, and generic best practices are outside the scope of this site." – πάντα ῥεῖ, Mast, t3chb0t, Greg Burghardt, Denis

If this question can be reworded to fit the rules in the help center, please edit the question.








  • 4




    First, you need to rewrite your question so that it states what your code is accomplishing and if necessary then also how and why. You want your code look professional? Start with the question look like that ;-)
    – t3chb0t
    Dec 16 at 11:44
















  • 4




    First, you need to rewrite your question so that it states what your code is accomplishing and if necessary then also how and why. You want your code look professional? Start with the question look like that ;-)
    – t3chb0t
    Dec 16 at 11:44










4




4




First, you need to rewrite your question so that it states what your code is accomplishing and if necessary then also how and why. You want your code look professional? Start with the question look like that ;-)
– t3chb0t
Dec 16 at 11:44






First, you need to rewrite your question so that it states what your code is accomplishing and if necessary then also how and why. You want your code look professional? Start with the question look like that ;-)
– t3chb0t
Dec 16 at 11:44

















active

oldest

votes






















active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

Terni

A new problem with tex4ht and tikz

Sun Ra