byref

By Ref parameters in VB.NET and C#

流过昼夜 提交于 2019-12-05 06:43:41
I have question related passing parameters byRef, I have VB.NET based class library in which some functions are defined with byref argument types. These parameters are parent class objects and when I tried to call this function and pass child class object in byref argument it works in VB.NET but I am unable to do same thing in C# following is test code i am trying Public Class Father Private _Cast As String Public Property Cast() As String Get Return _Cast End Get Set(ByVal value As String) _Cast = value End Set End Property End Class Public Class Son Inherits Father Private _MyName As String

Argument passed ByVal to VB.NET Function and manipulated there

梦想与她 提交于 2019-12-02 07:05:01
问题 In this Microsoft sample an array Of Doubles is passed to the functions MultiplyMatricesSequential(...) and MultiplyMatricesParallel(...) as argument result using ByVal modifier: http://msdn.microsoft.com/de-de/library/dd460713(v=vs.110).aspx Values in the arrays are being modified in these functions and the changes are available after the call to the functions returns. When I change ByVal to ByRef in function MultiplyMatricesSequential(...) nothing changes, when I change to ByRef in the

Argument passed ByVal to VB.NET Function and manipulated there

耗尽温柔 提交于 2019-12-02 05:23:39
In this Microsoft sample an array Of Doubles is passed to the functions MultiplyMatricesSequential(...) and MultiplyMatricesParallel(...) as argument result using ByVal modifier: http://msdn.microsoft.com/de-de/library/dd460713(v=vs.110).aspx Values in the arrays are being modified in these functions and the changes are available after the call to the functions returns. When I change ByVal to ByRef in function MultiplyMatricesSequential(...) nothing changes, when I change to ByRef in the second function the IDE complains arguments being manipulated in Lambda expressions cannot be passed by

Can you have “ByRef” arguments in AS3 functions?

吃可爱长大的小学妹 提交于 2019-12-01 04:26:57
问题 Any idea how to return multiple variables from a function in ActionScript 3? Anything like VB.NET where you can have the input argument's variable modified (ByRef arguments)? Sub do (ByRef inout As Integer) inout *= 5; End Sub Dim num As Integer = 10 Debug.WriteLine (num) '10 do (num) Debug.WriteLine (num) '50 Anything apart from returning an associative array ? return {a:"string 1", b:"string 2"} 回答1: Everything in AS3 is a reference aside from [u]ints. To generalize, everything that

Reflection: How to get the underlying type of a by-ref type

拥有回忆 提交于 2019-12-01 03:56:40
I was surprised to learn that "ref" and "out" parameters are not marked by a special attribute, despite the existence of ParameterInfo.IsOut, ParameterInfo.IsIn (both of which are always false as far as I can see), ParameterAttributes.In and ParameterAttributes.Out. Instead, "ref" parameters are actually represented by a special kind of "Type" object and "out" parameters are just ref parameters with an additional attribute (what kind of attribute I don't yet know). Anyway, to make a by-ref argument you call Type.MakeByRefType(), but my question is, if you already have a by-ref type, how do you

Does specifying the OutAttribute on ByRef internal methods currently do anything?

限于喜欢 提交于 2019-12-01 00:16:55
问题 VB.NET doesn't have out parameters, but you can specify <Out()> ByRef on COM and P/Invoke methods to get the same effect for external methods. Does specifying the same on internal methods (i.e. methods only called by .NET code) actually help the Jitter (or VB.NET compiler)? Or is it currently only useful as a programmer note. Is it possible it could be used in a future Jitter, or is this attribute lost when compiling? 回答1: I've confirmed a VB.NET <Out()> does cause a C# client to require out

Reflection: How to get the underlying type of a by-ref type

﹥>﹥吖頭↗ 提交于 2019-11-30 23:55:55
问题 I was surprised to learn that "ref" and "out" parameters are not marked by a special attribute, despite the existence of ParameterInfo.IsOut, ParameterInfo.IsIn (both of which are always false as far as I can see), ParameterAttributes.In and ParameterAttributes.Out. Instead, "ref" parameters are actually represented by a special kind of "Type" object and "out" parameters are just ref parameters with an additional attribute (what kind of attribute I don't yet know). Anyway, to make a by-ref

Are 'by ref' arguments in WCF bad or good?

放肆的年华 提交于 2019-11-30 15:38:49
问题 I've recently seen a WCF service declaring operation contracts with by ref arguments. I don't know why this design decision was taken (operations are void), but furthermore, I'm not able - from my WCF knowledge - to say if this is a good practice or not. Or if this is not relevant. What do you think? 回答1: However, According to this Microsoft Article a WCF Call behaves exactly like a Remote Procedure Call and ByRef arguments can be used to return data:- http://msdn.microsoft.com/en-us/library

Are 'by ref' arguments in WCF bad or good?

送分小仙女□ 提交于 2019-11-30 14:17:07
I've recently seen a WCF service declaring operation contracts with by ref arguments. I don't know why this design decision was taken (operations are void), but furthermore, I'm not able - from my WCF knowledge - to say if this is a good practice or not. Or if this is not relevant. What do you think? HainesyP However, According to this Microsoft Article a WCF Call behaves exactly like a Remote Procedure Call and ByRef arguments can be used to return data:- http://msdn.microsoft.com/en-us/library/ms733070.aspx Refer to the section: Out and Ref Parameters In most cases, you can use in parameters

Best Practice: ByRef or ByVal? in .Net

血红的双手。 提交于 2019-11-30 08:16:58
What are the things to consider when choosing between ByRef and ByVal. I understand the difference between the two but I don't fully understand if ByRef saves resources or if we even need to worry about that in the .Net environment. How do you decide between the two if the functionality doesn't matter in a situation? There's a lot of misinformation around about this. The main thing is that you understand the difference between value types and reference types , and the difference between pass by value and pass by reference . You almost always want to pass by value. Passing by reference is