|
theRealCondor wrote:
Field: Directly exposes an internal variable as PUBLIC. This, to some extent, breaks encapsulation, does not keep control of the variable within the control of the object, and is not CLS Compliant. No process can be performed against the public property (such as security or business logic) and as such the value of the variable should be treated as suspect by the owning object.
I don't understand your statment, you can set the field to be public AND readonly in which case control of the variable is kept within the object that contains it.
ASP.NET can never fail as working with it is like fitting bras to supermodels - it's one pleasure after the next - David Wulff
|
|
|
|
|
You are correct in stating that I can do:
public readonly int myInteger
and that variable will be in my control as far as it being a computed field. But I still cannot maintain control over that property as to who can access this property, nor can I hide the implementation of the data.
I also was not looking at specific instance examples, but rather full utilization of either public accessors or exposed public fields. So from that all-or-nothing viewpoint, my statement still holds true. Just to make sure we are on the same page....this is the definition I go by:
Encapsulation means that a group of related properties, methods, and other members are treated as a single unit or object. Objects can control how properties are changed and methods are executed. For example, an object can validate values before allowing property changes. Encapsulation also makes it easier to change your implementation at a latter date by letting you hide implementation details of your objects, a practice called data hiding.
From this definition, even if I maintain some amount of encapsulation with the public readonly direction, I also do not hide the implementation of that data. As such, if that integer now has to be long, I just broke my consumer because they know my implementation is integer. Thus I have broken some form of encapsulation.
_____________________________________________
I have a tendancy to where my mind on my sleeve I have a habit of losing my shirt...
|
|
|
|
|
Does anyone know how to create a program that can be operated via named pipes (I think that is what it is called)?
Two programs that I know of that use them are Microsoft Document Explorer (the help files for VS .NET) and Microsoft Money. The help files can be accessed using the "ms-help" pipe and Money can be accessed using the "money" pipe.
The functionality I would like in my program is much like Money, where if you enter a "money" address into Explorer or IE the program is launched and navigated to the right location.
I remember reading somewhere about how to do this but I haven't be able to find any information recently (I forgot what I searched for). Does anyone have an idea of how to do this? Or any references to some articles or help files somewhere that describe the process of APIs used.
Thank you.
|
|
|
|
|
|
|
. . . embedd an, say excel sheet in my application? I was looking at OLE, but as far as I can understand that has to do more with manipulating an open application rather than using components of the app.
What I'm really trying to do, is to create an Excel graph from data that my app collects.
Quite new to this!
Regards,
Venet.
Donec eris felix, multos numerabis amicos.
|
|
|
|
|
Search this forum with "Excel" in the search box right above.
How low can you go ? (MS rant)
|
|
|
|
|
Thanks,
I did do a search before posting, however all the examples that I've come accross describe Excel automation, i.e. opening excel and populating the fields in it.
My question was, if I can embedd an excel workbook in my application, rather than having that workbook opened in the Excel app itslef.
(Something like IE does when viewing .PDF files)
Regards,
Venet.
Donec eris felix, multos numerabis amicos.
|
|
|
|
|
You've got OLE components with progids such like Excel.Sheet and Excel.Chart (you probably already know the Excel.Application progid, which in turn launches Excel).
These are OLE components, not ActiveX controls. That's why they don't appear in the IDE (customize toolbox for instance).
But they are here and ready. For instance, They appear when you are in Word, Insert \ Object, then select either Microsoft Excel Sheet, or Microsoft Excel Chart. That's exactly the entry point for that.
More info here[^].
How low can you go ? (MS rant)
|
|
|
|
|
Example looks as exactly what I need. I'm going to try it out later.
Thanks for the reply.
Regards,
Venet.
Donec eris felix, multos numerabis amicos.
|
|
|
|
|
|
Thank you for the info. No wonder why it wasn't working!
I think that should increase my project mark for about 10%
Regards,
Venet.
Donec eris felix, multos numerabis amicos.
|
|
|
|
|
Like the API SendMessage, PostMessage.
---
|
|
|
|
|
You have a Search edit box, right above.
How low can you go ? (MS rant)
|
|
|
|
|
So what?
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
|
I wouldn't say it better...;P
How low can you go ? (MS rant)
|
|
|
|
|
can any body tell the sample code of inserting a row into a table and deleting a row from the table using acess data bases?
r00d0034@yahoo.com
|
|
|
|
|
public static bool Execute(string Sql)
{
OleDbCommand cmd = new OleDbCommand(Sql,
new OleDbConnection(connectionString));
cmd.Connection.Open();
cmd.ExecuteNonQuery();
if(cmd.Connection.State == ConnectionState.Open)
{
cmd.Connection.Close();
}
return true;
}
More good examples at: http://www.dotnetnotes.com/index.aspx?catID=4[^]
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Is it possible to have a single instance of a class library?
I need a class library that returns the same object when 2 clients are using reflection to create it:
Assembly assembly=Assembly.LoadFrom("myclasslibrary.dll");
Type[] tp=assembly.GetTypes();
object app=Activator.CreateInstance(tp[0]);
Can "app" be the same when I use this code in 2 windows applications?
Thanks,
Bruno
|
|
|
|
|
There is a design pattern called a singleton, which is a class designed in such a way that only one instance of it can ever be created. I've never created a singleton in a dll that is called from multiple windows applications, but you may find that the pattern applies to your situation.
There is a site I came accross a few months ago, The Pattern Digest, http://patterndigest.com/. It covers most well known design patterns, including the singleton. I beleive it also has links to other resources. It may help you create the kind of singleton object you need.
|
|
|
|
|
Actually, I thought of this, but it doesn't go across boudaries.
|
|
|
|
|
Remoting might work well for this; the sample chapter for Ingo Rammer's book Advanced .NET Remoting
[^] might just be enough to get you going.
Good luck,
James
Sig code stolen from David Wulff
|
|
|
|
|
I'm developing a firewall log monitoring application in C#
with the .NET framework, and I can't figure out something.
I'm trying to do a reverse lookup on an IP address. I
don't mean reverse lookup to a DNS entry. I'm looking to
find out the computer-name behind the IP address.
The only thing I can find that's remotely related is:
Dns.GetHostByName() and Dns.GetHostByAddress().
However,these methods deal with IPHost objects, which only
contain DNS or IP information -- nothing about computer-
name.
Does anyone have any idea how to get a computer-name from
an IP address in my C#/.NET application? Is there anything
in .NET that will accomplish this? If so, what is it? If
not, what can I call outside of .NET that I can
incorporate into my application?
Thanks!
|
|
|
|
|