ref

What is the purpose of the “out” keyword at the caller (in C#)?

岁酱吖の 提交于 2020-01-27 08:31:47
问题 When a C# function has an output parameter, you make that clear as follows: private void f(out OutputParameterClass outputParameter); This states that the parameter does not have to be initialized when the function is called. However, when calling this function, you have to repeat the out keyword : f(out outputParameter); I am wondering what this is good for. Why is it necessary to repeat part of the function specification? Does anyone know? 回答1: It means you know what you're doing - that you

How to use $ref in swagger file properly while working with swagger-ui-express and swagger-jsdoc

瘦欲@ 提交于 2020-01-24 06:01:11
问题 I started to use swagger with swagger-ui-express and swagger-jsdoc to auto document my existing API, which is written with nodejs and express (like described here - example). I came across a problem when I tried to add a $ref to an existing JSON Schema file (that sits inside my project on the same directory as all my js files) on my annotation. My directory looks like this I tried to write the local path ( ./schema.json ) and the absolute path, tried to use # , using many syntaxes and nothing

React Native - get refs of custom components in listview from renderRow

孤者浪人 提交于 2020-01-14 19:09:48
问题 I have a ListView and am trying to access the refs of custom components I have written in the renderRow. I need to do some direct manipulation of the custom components so I need to get the refs of these. It seems like other people have faced this issue too. I have tried following the recommendations in React Native: Refs in ListView and https://github.com/facebook/react-native/issues/897 but they don't seem to work for me. I have tried using the callback ref method as suggested. But, when I

passing in object by ref

天大地大妈咪最大 提交于 2020-01-11 09:52:11
问题 What is the difference between public function Foo(ref Bar bar) { bar.Prop = 1; } public function Foo(Bar bar) { bar.Prop = 1; } essentially what is the point of "ref". isn't an object always by reference? 回答1: The point is that you never actually pass an object . You pass a reference - and the argument itself can be passed by reference or value. They behave differently if you change the parameter value itself, e.g. setting it to null or to a different reference. With ref this change affects

How to establish the relation between two different trees in the root of the database using IDs?

只谈情不闲聊 提交于 2020-01-06 04:59:50
问题 I am trying to establish a relation between in my data structure between two different trees. One is the "Spaces" tree, the other is the "Depts". Logically the departments (depts) are inside the space (spaces). This question comes from this one: How can I get to the references inside dynamically generated references in firebase? Here is an image of my database structure: 回答1: this seem to be the most practical method: Tying the users node to the buildings : Template: <p>Name: <input type=

Unable to use ref to call the child method on a connect redux component

被刻印的时光 ゝ 提交于 2020-01-04 09:26:13
问题 I want to call SingleCard child component methods in renderHiddenItem . I have assigned different ref name for each renderItem . But when I call this.name , it is undefined . Anything is wrong in this code? How can I achieve this? <SwipeListView data={this.state.listViewData} renderItem={(data, i) => { const name = 'childRef'+i return ( <SingleCard ref={component => this.name = component} itm={data.item} /> ); }} renderHiddenItem={(data, i) => { const name = 'childRef'+i return (

How to access to actual Component when using ref and having ProxyComponent

南笙酒味 提交于 2020-01-04 05:19:29
问题 We have a ref to a react component and want to call a method of this component. When using the ref it is a "ProxyComponent" object. How can I use it as my actual component or what to do to be able to do this. I saw, that there is the attribute "renderedElement" and inside the attribute "type" which is the correct type of my actual component. But I didnt find a way to use it like this/to call my components methods. 来源: https://stackoverflow.com/questions/38077572/how-to-access-to-actual

Ref param returning array of unknown size. How to handle?

偶尔善良 提交于 2020-01-04 02:34:10
问题 A COM component exposes an API which expects a ref param of object type. As per the documentation of this API, it will fill the ref object with array of values. Now my problem is in prod env I can't predict the number of elements which I will get back. Following code will work. COMClass objCOM = new COMClass (); object colOfInts= new int[10]; // What if I don't know the following will return array of size 10? int errorcode = objCOM.FillThisIn(ref colOfInts); But what if I don't know the size

Update ref parameter inside anonymous method

*爱你&永不变心* 提交于 2020-01-03 08:44:08
问题 Is there a workaround to update a ref parameter inside an anonymous method? I know that the an anonymous method doesn't allow access to ref parameters of the outer scope, but is there another way to do it? I am using an external library for the MessageStream so cannot alter the arguments of the delegate... void DoWork(ref int count) { MessageStream Stream = new MessageStream(); Stream.MessageReceived += (o, args) => { //Error cannot use ref or out parameter inside anonymous method count++; };

React ref.current is null

时光怂恿深爱的人放手 提交于 2020-01-03 07:29:08
问题 I'm working on an agenda/calendar app with a variable time range. To display a line for the current time and show blocks for appointments that have been made, I need to calculate how many pixels correspond with one minute inside the given time range. So for example: If the agenda starts at 7 o'clock in the morning and ends at 5 o'clock in the afternoon, the total range is 10 hours. Let's say that the body of the calendar has a height of 1000 pixels. That means that every hour stands for 100