out

Difference between ref and out parameters in .NET

What is the difference between ref and out parameters in .NET? What are the situations where one can be more useful than the other? Can anybody illustrate with a code snippet where one can be used and another can't? ...

Using "ref" and/or "out" for Object type

I'm stuck with .Net 1.1 application (i.e. I can not use the generics goodies from 2.0 for now), and I was trying to optimize some parts of the code. As it deals a lot with runtime callable wrappers, which need to be released, I ended up to create a utility method which loops until all references are released. The signature of the method ...

Whats the difference between the 'ref' and 'out' keywords?

I'm creating a function where I need to pass an object so that it can be modified by the function. What is the difference between: public void myFunction(ref MyClass someClass) and public void myFunction(out MyClass someClass) Which should I use and why? ...

In C# 4.0 why can't an out parameter in a method be covariant?

Given this magical interface: public interface IHat<out TRabbit> { TRabbit Take(); } And this class hierarchy: public class Rabbit { } public class WhiteRabbit : Rabbit { } I can now compile this: IHat<WhiteRabbit> hat1 = null; IHat<Rabbit> hat2 = hat1; Which is great. But what if I define the interface differently: public...

C# out parameter performance

Do out parameters in C# have any performance implications I should know about? (Like exceptions) I mean, is it a good idea to have a method with an out parameter in a loop that will run a couple of million times a second? I know it's ugly but I am using it the same way as Int32.TryParse is using them - returning a bool to tell if some ...

why iterator methods can't take either 'ref' or 'out' parameters?

I tried this earlier today: public interface IFoo { IEnumerable<int> GetItems_A( ref int somethingElse ); IEnumerable<int> GetItems_B( ref int somethingElse ); } public class Bar : IFoo { public IEnumerable<int> GetItems_A( ref int somethingElse ) { // Ok... } public IEnumerable<int> GetItems_B( ref in...

Assigning out/ref parameters in Moq

Is it possible to assign an out/ref parameter using Moq (3.0)? I've looked at using Callback(), but Action<> does not support ref parameters because it's based on generics. I'd also preferably like to put a constraint (It.Is) on the input of the ref parameter, though I can do that in the callback. I know that Rhino Mocks supports this ...

When should I use out parameters?

I don't understand when an output parameter should be used, I personally wrap the result in a new type if I need to return more than one type, I find that a lot easier to work with than out. I have seen method like this, public void Do(int arg1, int arg2, out int result) are there any cases where that actually makes sense? how a...

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

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 wonde...

jQuery droppable out event fails to trigger?

$(".LWdrop").droppable({ accept: ".LW", drop: function(event, ui){ ui.draggable.addClass("LWactive"); $(this).droppable('option', 'accept',''); $(this).css("background-color", "#444444"); }, out: function(event, ui){ $(this).droppable('option', 'accept', '.LW'); u...

is there a Best Practice or industry standard for the length of "time out" for web pages for Ecommerce businesses with website containing Personal Identity Information?

is there a Best Practice or industry standard for the length of "time out" for web pages for Ecommerce businesses with website containing Personal Identity Information? ...

mysql cluster auto increment out of sync

Hi All, I have two mysql cluster data nodes as Master and slave. But after certain number of rows there is difference between two auto_increment values from one node to another. The difference is of Node 2 is ahead than node 1 by 11. can anyone suggest any fix on this? how to resolve this. and when such type of situation comes? Than...

XPConnect (Firefox) - how to get value out of object

I'm trying to create a read from clipboard javascript function, and it's generally working, but I can't seem to extract the actual string from the object I create with the out parameter (Components.interfaces.nsITransferable). In case you're wondering, this is for a local intranet, and I have enabled clipboard access. This is the part o...

Using REF & OUT keywords with Passing by Reference & Passing by Value in C#

Here is what I understand so far: PASS BY VALUE Passing by value means a copy of an argument is passed. Changes to that copy do not change the original. PASS BY REFERENCE Passing by reference means a reference to the original is passed. changes to the reference affect the original. REF Keyword REF tells the compiler that the objec...

why the session in iis automatically log out ?

I used iis6, and when i called a function Directory.delete(), the all the session relate this website will be logged out. and i debugged the website, i found no exception. any one have ideas on this ? Thanks in advance! ...

How to name a method that has an out parameter?

Hi, What is the common preference to name a method that has an out parameter inside? Usually I use Get as a prefix to mention that the method returns a value (like GetMyBusiness). But what if there is an out parameter that will be set after the method call? Should the method name mention this and focus only the return value? thanks...

jquery hover() mouseOut event not firing when mouse is moved quickly over link

Hi guys need your help on hover mouse out event not firing Problem i basically have simple link list and when you hover over it it appends a div (loading data in this div from xml) and on hover out it removes the div, but it only happens when mouse moves slowly over the links as soon as mouse moves more fast then usual over the links ...

Add my site logo to google check out page...

hi I want to customise google check out page . Ie , I want to place my logo in google check out page that will appear when i clicked google check out button in my site this is the place order page . Is it possible to customize the google check out place order page ? ...

C# PInvoke out strings declaration

In C# PInvoke, how do I pass a string buffer so that the C DLL fills it and returns? What will be the PInvoke declaration? The C function declaration is int GetData(char* data, int buflength); In C#, I have declared it as [DllImport(DllName)] static extern Int32 GetData([MarshalAs(UnmanagedType.LPStr)]StringBuilder receiveddata, In...

tweetboard effect sliding frame

When you visit this link http://tweetboard.com/alpha/ you will see a Tweets label on the left. When you click this tweets label, another site loads inside this panel/iframe. Can you please help me understand how this feature is created? It seems that I should be able to create this effect using standard HTML and jQuery. If you can ...