变量类型为'Type'的声明变量(Declaration variable with type in variable of type 'Type')
我在类中使用'Type'类型的变量:
class A { public static Type MyType; }
我在任何地方都会声明这个变量。 例:
A.MyType = b.GetType();
第一个问题:我需要声明存储在MyType中的类型的新变量。
<MyType> myValue = new <MyType>;
第二个问题:我需要一个函数来指示是否可以将'Type'的变量还原为其他变量。
I have variable in my class with type of 'Type':
class A { public static Type MyType; }
And I declared this variable with anywhere construction. Example:
A.MyType = b.GetType();
First problem: I need declare new variable with type stored in MyType.
<MyType> myValue = new <MyType>;
Second problem: I need a function that indicates whether reducible to each other variables of the 'Type'.
原文:https://stackoverflow.com/questions/14997699
更新时间:2023-05-18 11:05
最满意答案
没有等价物,你只需直接引用属性。 如果需要重复使用复杂表达式,则可以将其封装为计算属性 。
There's no equivalent, you just refer to properties directly. If there's a complex expression that you need to use repeatedly, you can encapsulate it as a computed property.
相关问答
更多-
需要帮手的把手(Handlebars helper in requireJS)[2022-03-30]
从Handlebars doc帮助者 : Handlebars助手呼叫是一个简单的标识符,后跟零个或多个参数(用空格分隔)。 每个参数都是Handlebars表达式。 [...] 把手助手还可以接收可选的键值对序列作为其最终参数(在文档中称为散列参数)。 散列参数中的键必须都是简单的标识符,并且这些值是Handlebars表达式。 这意味着值可以是简单的标识符,路径或字符串。 要使用你的参数作为散列,你可以将你的助手称为 {{{addOn . Code=CampaignColorType.Code HexC ... -
快递把手的部分帮手(Express Handlebars 'partial' helper)[2023-11-12]
最终代码应该是这样的: var expressHandlebars = require('express-handlebars'); var Handlebars = expressHandlebars.create({ .... helpers: { partial: function(partialName, context, hash) { return Handlebars.partials[partialName](context, has ... -
这不是助手的工作方式。 您需要自己从选项对象中获取上下文: Ember.Handlebars.registerHelper('addressActions', function(path, options) { // passed context objects are stored in options.contexts // as you are only passing one context, it is the first one in the array var address = ...
-
在较新版本的Handlebars索引(或对象迭代的情况下的关键字)默认情况下与标准的每个帮助器一起提供。 摘录: https : //github.com/wycats/handlebars.js/issues/250#issuecomment-9514811 当前数组项目的索引已经通过@index可用了一段时间: {{#each array}} {{@index}}: {{this}} {{/each}} 对于对象迭代,请使用@key: {{#each object}} {{@key}} ...
-
定制快递把手如果帮手(Custom Express Handlebars If Helper)[2021-12-03]
不幸的是,这些东西的把手很糟糕,我认为你需要做一些像你所做的那样的定制助手。 我会建议编写自己的block-helper,它接受三个参数并执行基本的逻辑检查(比如和,或者大于,小于模数),如下所示: {{#ifCond varOne "%" 2}} {{/ifCond}} ifCond帮助器实现有一个切换器来处理不同的操作符。 Handlebars is unfortunately quite bad at these things, and I think you need to do some cus ... -
没有等价物,你只需直接引用属性。 如果需要重复使用复杂表达式,则可以将其封装为计算属性 。 There's no equivalent, you just refer to properties directly. If there's a complex expression that you need to use repeatedly, you can encapsulate it as a computed property.
-
子表达式上的Handlebars文档说明如下: Handlebars提供对子表达式的支持,允许您在一个小胡子中调用多个帮助程序,并将内部帮助程序调用的结果作为参数传递给外部帮助程序。 Subexpressions由括号分隔 。 [重点补充] 这意味着我们需要告诉Handlebars, arr 不是要在上下文对象上查找的属性,而是要调用的帮助器,我们通过将内部帮助器包装在括号中来实现: {{#each (arr)}} 话虽如此,我同意Mjh的评论 ,他说这不是帮助者的正确用法。 您的数据应直接传递到模板函数 ...
-
手柄中的子串辅助器(Substring helper in handlebars)[2023-09-28]
只是一点点错误。 if (a.includes(b)) if (b.includes(a))How to render html with Handlebars.js var hbs = require('express-hbs'); hbs.registerHelper('svg', require('handlebars-helper-svg')); var hbs = require('express-hbs'); hbs.registerHelper('svg', require('handlebars-helper-svg'));把手缺少帮手(Handlebars Missing helper)[2022-07-15]
你尝试过这种技术吗? 从这里https://www.npmjs.com/package/express-handlebars var express = require('express'); var exphbs = require('express-handlebars'); var app = express(); var hbs = exphbs.create({ // Specify helpers which are only registered on this instance ...相关文章
更多- ServletOutputStream cannot be resolved to a type
- HTTP Content-Type 内容类型详解
- The content of element type "package" must match "...
- Java变量类型
- 微信公众号接口添加菜单时错误(errcode":40017 invalid button type)
- maven项目使用SOLR时报 previously initiated loading for a different type with name "javax/servlet/http/HttpServletRequest" 错的解决方法
- Lua 变量声明与使用
- Ruby常用的内部变量
- jsp:getProperty对变量使用的问题
- Scala定义变量
最新问答
更多- 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
- 如何通过引用返回对象?(How is returning an object by reference possible?)
- 矩阵如何存储在内存中?(How are matrices stored in memory?)
- 每个请求的Java新会话?(Java New Session For Each Request?)
- css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
- 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
- xcode语法颜色编码解释?(xcode syntax color coding explained?)
- 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
- 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
- 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
- 西安哪有PLC可控制编程的培训
- 在Entity Framework中选择基类(Select base class in Entity Framework)
- 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
- 电脑二级VF有什么用
- Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
- 金华英语角.
- 手机软件如何制作
- 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
- 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
- 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
- Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
- 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
- python的访问器方法有哪些
- DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
- 在Ruby中对组合进行排序(Sorting a combination in Ruby)
- 网站开发的流程?
- 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
- 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
- 透明度错误IE11(Transparency bug IE11)
- linux的基本操作命令。。。