473,396 Members | 2,115 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Can't reference classes within a class

I have a dataclass that was created by a code generator. A snippit of its
output is as follows:

namespace SoftwareAG.EntireX.NETWrapper.Generated.laf801n1.G roups

{

public class Laf801n1

{

public class Laa001a2

{

public string environment ;

public string sourceApp ;

}

public class Laf801a1

{

public string certnoSeq ;

public string lender ;

}

public class Laf801a2

{

public string respD ;

public string respT ;

public string custName ;

}

}

}

I would like to pass this as a reference. The following code snippet works:

using SoftwareAG.EntireX.NETWrapper.Generated.laf801n1.G roups;

using SoftwareAG.EntireX.NETWrapper.Generated.laf801n1;

namespace LATF.TSR.DAL

{

public class FldDAL : BaseDAL

{

public void PlaceFooOrder(ref Laf801n1.Laa001a2 hdr, ref
Laf801n1.Laf801a1 request, ref Laf801n1.Laf801a2 response)

{

Flddev txn = new Flddev();

txn.Laf801n1(ref hdr, ref request, ref response);

}

}

While this does not (in fact, it can't even be done. intellisense shows
things like Laf801n1.ToString(), etc.):

using SoftwareAG.EntireX.NETWrapper.Generated.laf801n1.G roups;

using SoftwareAG.EntireX.NETWrapper.Generated.laf801n1;

namespace LATF.TSR.DAL

{

public class FldDAL : BaseDAL

{

public void PlaceFooOrder(ref Laf801n1 etx)

{

Flddev txn = new Flddev();

txn.Laf801n1(ref etx.Laa001a2, ref etx.Laf801a1, ref
etx.Laf801a2); // This is what I would like to code.

}

}

Is what I am attempting doable?


Mar 22 '06 #1
3 3087
First off make sure your namesapces are PascalCased and that you aren't
exposing public fields. You need to be using properties. I can't
think of a code generator in the world that would break the .NET
framework coding rules like the above.

You are trying to send a class. You can't do that. You can send
objects. You probably want to do something like

Laf801n1.Laa001a2 something1 = new Laf801n1.Laa001a2( );
Laf801n1.Laf801a1 something2 = new Laf801n1.Laf801a1( );
Laf801n1.Laf801a2 something3 = new Laf801n1.Laf801a2( );

txn.Laf801n1(ref something , ref something2, ref something3);

Mar 22 '06 #2
Classes are Reference type structure, to pass instance of a class by
reference you don't need "ref" keyword. Have you tried by simply removing ref
keywords?
Mar 22 '06 #3
Nested class declarations is a namespace-like feature. It does not make one
class contain an instance of another.

Example:

public class Outer
{
public class Inner { }
}

in this case, if you construct an object from Outer, it does not automatically
contain a field or anything containing an instance of Inner.

You need something like:

public class Outer
{
public class Inner { }
public Inner InnerObject = new Inner();
}

then:

Outer o = new Outer();
o.InnerObject.XYZ...

"public class" and "public struct" only defines the type, it does not declare
an object or field.

--
Lasse Vågsæther Karlsen
http://usinglvkblog.blogspot.com/
mailto:la***@vkarlsen.no
PGP KeyID: 0x2A42A1C2
Mar 22 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Chris F Clark | last post by:
In our C++ project we have some internal bug reporting macros that we use to get useful information when the program does something unexpected. Essentially at the point of the error, we invoke an...
22
by: Matthew Louden | last post by:
I want to know why C# doesnt support multiple inheritance? But why we can inherit multiple interfaces instead? I know this is the rule, but I dont understand why. Can anyone give me some concrete...
5
by: Just Me | last post by:
Given a button name Btn_5 and Index=5 I want to do something like dim zz as string = Btn_??Index??.Text or given an array of buttons, do:
5
by: Derek Martin | last post by:
I am creating a windows service and have added a reference to a DLL project that I have created. That DLL file is correctly referenced in both a windows app and a web app, all in the same...
3
by: Solution Seeker | last post by:
Hi All, I am here with a Query and need a Solution for it. The Query is as Follows, We have 3 Projects in a Solution - Say UI, CMN and PRD First One Deals with UI Forms Second One Deals...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
24
by: Paul | last post by:
I am taking over an existing app and having trouble understanding their references. They have encapsulated Pear packages in the directory structure like: /site /site/html/Pear.php...
3
by: Arodicus | last post by:
This is bugging me: how do I reference the topmost node (HTML) within a document? I'd like to set a class on it, which specifies various browser/os/versions so that several...
1
SamKL
by: SamKL | last post by:
Hey, I'm no expert on PHP, and I have somewhat of an understanding of object oriented code. Anyway, getting right to the problem. I'm using PHP4, so base it off of that. Basically I have 2...
17
by: Blau | last post by:
I'm trying to use the System.Windows.Controls namespace, but when I try to add a reference to it I don't see it in the list. I see a System.Windows.Forms, but not a System.Windows.Controls. Can...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.