首页 \ 问答 \ 清除二维数组(Clearing two-dimensional array)

清除二维数组(Clearing two-dimensional array)

我使用的是10个元素的二维数组,但我的代码非常慢。

Dim myArray As String(,) 
For i=0 to 100
   'Clear Array. (This line is really slow)
   myArray = New String(,) {{"", ""}, {"", ""}, {"", ""}, _
   {"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""}}

   'Populate array
   fillArray(myArray) 

   'Do stuff with array
   useArray(myArray)
Next i

我在for循环的每次迭代中创建一个新的空数组。 有没有办法可以使用相同的数组但只是清除它?


I am using a two-dimensional array of 10 elements, but my code is extremely slow.

Dim myArray As String(,) 
For i=0 to 100
   'Clear Array. (This line is really slow)
   myArray = New String(,) {{"", ""}, {"", ""}, {"", ""}, _
   {"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""}, {"", ""}}

   'Populate array
   fillArray(myArray) 

   'Do stuff with array
   useArray(myArray)
Next i

I create a new empty array with every iteration of the for loop. Is there a way I can use the same array but just clear it instead?


原文:https://stackoverflow.com/questions/5117916
更新时间:2023-10-14 21:10

最满意答案

它调用一个函数,两次都称为thinkup_bodystyle()。 我们无法读取你的代码,所以无论是在某处都有一个名为thinkup_bodystyle()的函数,或者你显示的代码没有被激活,或者有某种错误捕获机制在进行。 在任何情况下,你都会想到这个函数会吐出某种CSS或其他东西。


It's calling a function, both times, called thinkup_bodystyle(). We can't read you code, so either there IS a function called thinkup_bodystyle() somewhere, or the code you've shown isn't getting activated somehow, or there is some kind of error catching mechanism going on. In anycase you'd imagine this function spits out some kind of CSS or something.

相关问答

更多
  • 你需要使用get_stylesheet_directory(); 。 这将转到当前主题,孩子或父母。 get_template_directory(); 如果您使用子主题,仍将转到父主题。 You'll need to use get_stylesheet_directory();. This will go to the current theme, child or parent. get_template_directory(); will still go to the parent theme i ...
  • 创建一个能够在任何主题中查看(并应用主题)的自定义php页面将非常困难 。 每个wordpress页面调用该特定主题的特定主题功能,以及引用该主题的文件以生成页眉,页脚,css文件,javascript文件等。您的自定义页面需要计划所有这些突发事件, 每个可能使用的主题 。 这是另一种解决方案:通过这个插件将PHP代码直接注入到标准的wordpress页面http://wordpress.org/extend/plugins/allow-php-in-posts-and-pages/ 含义:你制作一个普通的 ...
  • 这个并不困难......这里有一些代码可以让你开始:
  • 它调用一个函数,两次都称为thinkup_bodystyle()。 我们无法读取你的代码,所以无论是在某处都有一个名为thinkup_bodystyle()的函数,或者你显示的代码没有被激活,或者有某种错误捕获机制在进行。 在任何情况下,你都会想到这个函数会吐出某种CSS或其他东西。 It's calling a function, both times, called thinkup_bodystyle(). We can't read you code, so either there IS a fun ...
  • 在仪表板中,查看左侧面板,然后选择外观>编辑器 。 在那里,查看屏幕右侧并选择您要编辑的网站部分(帖子,样式表等)。 这是您可以进行更改的地方。 我认为这就是你要求的。 From your dashboard, look on the left side panel and choose appearance > editor. Once there, look to the right of your screen and choose which part of the site you'd like ...
  • 更新的答案 您可能希望通过注册动态窗口小部件并在footer.php显示来显示它: 注册页脚小部件 register_sidebar( array( 'name' => 'footer Sidebar 1', 'id' => 'footer-sidebar-1', 'description' => 'Appears in the footer area', 'before_widget' => '
  • 罗曼问道: ...如何创建一个新主题(了解Wordpress的每个功能,解释functions.php文件中的每个功能,如何正确添加Wordpress帖子内容)。 从代码http://codex.wordpress.org/Main_Page开始 WordPress的在线手册和WordPress信息和文档的活动存储库。 Romain asked: ...how to create a new theme (understand every features of Wordpress, explaining ...
  • 子主题是一个主题,它继承了另一个主题的功能和样式,称为父主题。 子主题是修改现有主题的推荐方法。 如何创建子主题 创建子主题目录 (将子主题命名的常用方法作为父主题加上-child末尾添加。) 创建style.css 创建functions.php 样式表必须以下面的内容(样式表标题)开头: /* Theme Name: XYZ Child Theme Theme URI: http://example.com/themes/spacious/ Description: XYZ Child theme Au ...
  • 你可以试试这个:
    Example.net
    Example.com
    或者如果你想使用正则表达式:
    Examp ...
  • 你可以根据主题的制作方式重新使用CSS,主要部分应该是造型。 XHTML应该不是问题,因为它通常很短并且有很多占位符。 只需将WP占位符替换为您自己的占位符或编写适配器。 是的,如果你有时间,一定要写一个适配器。 您甚至可以重复使用或出售它。 You can surely reuse the CSS depending how well the theme was crafted, the main part should be in the styling. The XHTML should not be ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)