C#如何为静态数组创建个人todynamic()函数 [英] C# how can I create my personal todynamic() function for static arrays

查看:88
本文介绍了C#如何为静态数组创建个人todynamic()函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须为所有类型的静态数组创建ToDynamic()函数,它返回一个新的动态数组,该数组包含调用该函数的数组元素,就像这样`

I must create ToDynamic() function for all types of static arrays,which returns a new dynamic array consisting of the elements of the array from which the function was called, Like this`

int [] x = {1,2,3,4};




List<int> arr = x.ToDynamic();





我尝试过:



我是初学者,请帮助我。

谢谢:)



What I have tried:

I'm a beginner,please help me.
Thanks :)

推荐答案

这是什么,你第六次发布同样的问题?

我们不会为你写的 - 我们愿意帮助你,但你必须自己做这项工作,否则你将无法学习。

我们不做你的功课:这是有原因的。它就是为了让你思考你被告知的事情,并试着理解它。它也在那里,以便您的导师可以识别您身体虚弱的区域,并将更多的注意力集中在补救措施上。



现在,回到原来的问题,并且读我说的话。想想你自己,并尝试解决它。然后告诉我们你有什么,并解释它为什么不起作用。这是一个简单的代码:即使是蛮力版也是如此,五行?

亲自尝试一下,你可能会发现它并不像你想象的那么难!



如果您遇到特定问题,请询问相关问题,我们会尽力提供帮助。但我们不打算为你做这一切!



再次发布,你可能会被视为滥用 - 这会让你被抛弃。
This is the what, sixth time you have posted the same question?
We are not going to write it for you - we are willing to help, but you have to do the work, yourself or you will not learn.
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Now, go back to your original question, and read what I said. Think for yourself, and try to work it out. Then show us what you have, and explain why it doesn't work. This is trivial code: even a brute force version is what, five lines?
Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!

Post it again, and you risk being treated as abusive - which will get you thrown off the site.


这是一个想法: c# - .ToList()和.Reverse()之类的扩展方法如何看待封面? - Stack Overflow [ ^ ]
Here is an idea: c# - how do extension methods like .ToList() and .Reverse() look behind the covers? - Stack Overflow[^]


这篇关于C#如何为静态数组创建个人todynamic()函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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