I have an object with the following structure: (pseudocode)
class Client
{
- int ID
- int? ParentID
- string Name
- datetime CreateDate
- int ACClientID
- List <Client> Clients }
I want to loop through the whole nested structure using a recursive foreach, to set the ACClientID of ALL to a value.
I know that the enumerator in a foreac...
Duplicate of: What is the purpose of the “out” keyword at the caller?
Why I need to use 'ref' keyword in both declaration and Call.
void foo(ref int i)
{
}
For example, Consider above function. If I will call it without ref keyword as
foo(k);
it will give me error :
Argument '1' must be passed with the
'ref' keyword
W...
GCC's recent support for atomic operations (as described here) is great, and is 90% of what we need. Unfortunately, some of our products still need to run on Windows and so we need atomic integer operations for Windows as well.
In the past, we had custom assembly language implementations for all our platforms, but I'd like move all the...
Here is what I mean:
I need to be able to substitute this ugly looking C# code:
if (attribute.Name == "Name") machinePool.Name = attribute.Value;
else if (attribute.Name == "Capabilities") machinePool.Capabilities = attribute.Value;
else if (attribute.Name == "FillFactor") machinePool.FillFactor = attribute.Value;
into something like...
So I'm working on this VB to C# web application migration and came across an issue that I'm hoping there is an easy work around for. There's a webform that uses the GridView control. In code, it passes the columns collection into a method that adds columns dynamically based on the user, permissions, and environment. So, the columns were ...
hi, i have a piece of code that isn't working, i'd appreciate any help you guys can provide me
the code below is generating an exception ... but i'd think it shouldn't, unless i'm misinterpreting the ref semantics.
EDIT: thanks for all the answer ... i know i'm instatiating a new Queue object in the One.Produce method ... but this is w...
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...
Hello,
I'm studying databases and am currently working on a object-relational DB project and I've encountered a small problem with the number of possible constraints in an object table. I'm using "Database Systems: The Complete Book" by Hector Garcia-Molina (and other authors) as a reference and there's a general SQL example like this:
...
I am trying to call a function in a unmanaged C++ dll.
It has this prototype:
[DllImport("C:\\Program Files\\MySDK\\VSeries.dll", EntryPoint = "BII_Send_Index_Template_MT" )]
internal unsafe static extern Int32 BII_Send_Index_Template_MT(IntPtr pUnitHandle, ref BII_Template template, Int32 option, Boolean async);
BII_Template tem...
Is there any way to maintain the same functionality in the code below, but without having to create the delegate? I'm interfacing with a 3rd-party API that contains a number of various DeleteSomethingX(ref IntPtr ptr) methods and I'm trying to centralize the code for the IntPtr.Zero check.
private void delegate CleanupDelegate(ref IntP...
I have similar methods, in the Business layer. New to unit testing and sometimes get confused. For an idea, can you suggest, what will be a better approach to test this method
behaviour? I am using C# NUnit and Moq
public int? AddNewCatRetID(string categoryName)
{
int? categoryID = 0;
Adapter.AddNewBlogCategoryReturnID(categ...
Hi,
I'm having some troubles using Session Variables as they are being used as Reference and I want to use them as value.
I got to this debuging my solution and I created something like:
DataTable dt =
(DataTable)HttpContext.Current.Session[
"SearchReturn-DataTableSchema"];
// Adding Rows of Data to DataTa...
Hi everyone. Please help me out here because im getting kind of confused.. I have a form in a C# winforms project and a couple of methods that are suposed to perform some tasks for this particular form and all derived ones, so one of those helper methods can make the example.. this one should fill comboboxes with a dataset. Its working p...
Is it possible to use \ref{chap:conclusion} to refer to the actual name of the chapter instead of the chapter counter in LaTeX? So that I can do this:
See the \ref{chap:conclusion} chapter for more information
See the Conclusion chapter for more information
instead of:
See Chapter \ref{chap:conclusion} for more
See Chapter 6 for mo...
Is there a way to force the this keyword to act as a ref argument? I would like to pass in a visitor that modifies multiple properties on the object, but this only wants to act like a value parameter.
Code in Object:
public void Accept(Visitor<MyObject> visitor)
{
visitor.Visit(this);
}
Code in Visitor:
public void Visit(ref Vis...
Here's my class:
public class UserInformation
{
public string Username { get; set; }
public string ComputerName { get; set; }
public string Workgroup { get; set; }
public string OperatingSystem { get; set; }
public string Processor { get; set; }
public string RAM { get; set; }
...
Hi all
We deliver videos to iphones using a Ref Movie but with a dynamic content reference so the same Ref Mov template can be used for serving all our different videos by dynamically writing a video path.
Now when we serve a regular Ref Mov created in QT the Ref Mov becomes active/clickable within a split second but when we use the d...
Is this a valid value for this c# class default constructor,
public class SMSCOMMS
{
public SMSCOMMS(ref string COMMPORT)
{
SMSPort = new SerialPort();
SMSPort.PortName = COMMPORT;
SMSPort.BaudRate = 9600;
SMSPort.Parity = Parity.None;
SMSPort.DataBits = 8;
SMSPort.StopBits = StopBits.One;
SMSPort.Hands...
Hi,
right function declaration is:
[DllImport("user32.dll")]
static extern int SetScrollInfo (IntPtr hwnd, int n, ref SCROLLINFO lpcScrollInfo, bool b);
I declared it like:
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
static extern int SetScrollInfo (IntPtr hwnd, int n, SCROLLINFO lpcScrollInfo, bool b);
c...
In the project I am working on uses established and then used in many parts
function Ajax (recvType, waitId)
I want to use the "prototype framework" it have class Ajax
it is better to do and where to change ?
or change in prototype and afte using another name instead Ajax some else name?
Or change in all project ?
or is there a way ...