|
Excellent example, afronaut! Feel like writing an article?
By the way, can I ask [slightly off topic] - why did you choose to use get... methods, rather than read only properties?
eg
public interface ISummarizable {
XMLDocument SummaryXML { get; }
DataSet SummaryDataSet { get; }
} Or was this just an arbitrary decision?
Paul
|
|
|
|
|
Paul Riley wrote:
By the way, can I ask [slightly off topic] - why did you choose to use get... methods, rather than read only properties?
Now for then even MORE off topic answer.
If a property has a ReadOnlyAttribute, the property will only be readonly to the designer, but it is still settable programatically, where only defining only a get property is never settable (pretty obvious)
Cheers
Give them a chance! Do it for the kittens, dear God, the kittens!
As seen on MS File Transfer: Please enter an integer between 1 and 2.
|
|
|
|
|
That's not an answer... at least not to the question I asked
When I said "read only", I didn't mean "ReadOnly", I meant "get but not set". Then it's not available in the designer or the program (actually, it can still be visible in the designer but greyed out).
Paul
|
|
|
|
|
I think it's just that old java habits die hard.
Also, returning objects gives me a little more ease in passing them to additional methods.
As far as writing an article, great idea! I may have to lock myself in the labratory for a few hours tonight.
Best regards,
*->>Always working on my game, teach me
*->>something new.
cout << "dav1d\n";
|
|
|
|
|
Is there a class builder wizard in Visual Studio.NET? If not, is there another free/cheap one available?
Thanks much
*->>Always working on my game, teach me
*->>something new.
cout << "dav1d\n";
|
|
|
|
|
I started working on one, but phew it's gonna take some time still....
Give them a chance! Do it for the kittens, dear God, the kittens!
As seen on MS File Transfer: Please enter an integer between 1 and 2.
|
|
|
|
|
leppie wrote:
I started working on one, but phew it's gonna take some time still....
Open Source it already!
*->>Always working on my game, teach me
*->>something new.
cout << "dav1d\n";
|
|
|
|
|
I pocket a class in a dll.And the class implement a interface.
and then I load the dll with these code:
Assembly a = Assembly.Load("mydll");
Type t = a.GetType("mydll.myClass");
object obj = Activator.CreateInstance(t);
MyInterface Imyclass=(MyInterface)obj;//this line will cause runtime error;
The biggest problem is that when I use it as below,it can work.
import the dll to my project first.
MyInterface Imyclass=new myClass();
What is the problem??? Anyone can help???
lost my way
|
|
|
|
|
fftongzhi wrote:
Type t = a.GetType("mydll.myClass");
object obj = Activator.CreateInstance(t);
Type t2 = a.GetType("mydll.myClass");
Type t = t2.GetInterface("MyInterface");
MyInterface obj = (MyInterface) Activator.CreateInstance(t);
Does that work?
Give them a chance! Do it for the kittens, dear God, the kittens!
As seen on MS File Transfer: Please enter an integer between 1 and 2.
|
|
|
|
|
Are you fun me???Interface can not be create a instance.
Type t = t2.GetInterface("MyInterface");
MyInterface obj = (MyInterface) Activator.CreateInstance(t);
Absolutely these codes will make a exception;
Can you make a test before makeing your answer?
lost my way
|
|
|
|
|
fftongzhi wrote:
Type t = t2.GetInterface("MyInterface");
Oops, was pasting from my rusty brain
Type t = a.GetType("mydll.myClass");
//do some test here to make sure class has interface
MyInterface obj = (MyInterface) Activator.CreateInstance(t);
To be honest, I think the problem is as Eric described it. Define your inferface in another assembly, compile once and leave it
Give them a chance! Do it for the kittens, dear God, the kittens!
As seen on MS File Transfer: Please enter an integer between 1 and 2.
|
|
|
|
|
Apologize for my discourteous words.
I can get the interface in myclass.
let's try again. ( ( ( (
lost my way
|
|
|
|
|
Is the interface compiled along with the assembly that you load? Interfaces have assembly identity, so both the assembly you'll load and the loader need to reference the interface in the same assembly.
There can also be version number issues. If the interface gets recompiled after you've built mydll, the versions won't match.
|
|
|
|
|
Thank you first,but the problem is still here.
I think it doesn't matter with the version.
I made a test like this.
First I build a interface(Imyclass) in a Imyclass.dll;
Reference it in the project of myclass which implemented the Imyclass and build a myclass.dll
And then,reference the Imyclass.dll to the project want to load myclass.dll at runtime.
and these codes will still create a exception(specified cast is not void);
Imyclass ImyCls =(Imyclass)Activator.CreateInstance(t);
In this case,the version of Imyclass.dll will same in each project,and the problem is still going on.
Some thing special is ,in myclass,I used some struct defined by myself for fuction parameters and return value.Is that the problem of system defult serialization???
lost my way
|
|
|
|
|
very lucky,it works.
the problem is I use the interface dll in diffirent version.
Becouse I made a cope of the dll for load,when I update one I missed the other one.hehe............
lost my way
|
|
|
|
|
Is there any tutorials about ADO.NET in C# somewhere that you might know?
I want to learn how to add, remove and update an Access database.
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++!
|
|
|
|
|
Rickard Andersson wrote:
want to learn how to add, remove and update an Access database.
Why not use OleDb ? I can email you a little project I did for my folks's company. Just a Sales Reporting app on Access
Give them a chance! Do it for the kittens, dear God, the kittens!
As seen on MS File Transfer: Please enter an integer between 1 and 2.
|
|
|
|
|
Yes for sure!
It was OleDB I meant
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++!
|
|
|
|
|
ADO.NET has OleDB classes. Why not use those? Besides that, the System.Data.OleDb.OleDbDataAdapter is sweet. If the functionality is in .NET, why not use it?
Norm Almond: I seen some GUI's in my life but WTF is this mess
Leppie: I made an app for my sister and she wouldnt use it till it was colorful enough
Norm:good point leppie, from that statement I can only deduce that this GUI must be aimed at children
Leppie:My sister is 25
-Norm on the MailMagic GUI
|
|
|
|
|
Can some one help me with how to start setting up an MS-SQL Connection in C#?
|
|
|
|
|
There are some pretty good articles here:
http://www.codeproject.com/cs/database/[^]
Norm Almond: I seen some GUI's in my life but WTF is this mess
Leppie: I made an app for my sister and she wouldnt use it till it was colorful enough
Norm:good point leppie, from that statement I can only deduce that this GUI must be aimed at children
Leppie:My sister is 25
-Norm on the MailMagic GUI
|
|
|
|
|
if i hava a class
class a
{
int a;
CString str;
};
i want to write its object into a file and send that file through a network to different computer and i want to recive that object again if i have the same class there.
may i read the same object on network from a file?
any body can explain my idea into code like
how to write object into file ?
how to read object on the network (having same class there) from file ?
r00d0034@yahoo.com
|
|
|
|
|
Aren't ya in wrong forum now?
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++!
|
|
|
|
|
on toolbar i want to show show a gif ,
how to do ?
study and user
|
|
|
|
|
bclangren wrote:
how to do ?
Toolbars requiere an ImageList to get the pictures from. The documentation says that an ImageList can be created from a bitmap, icon, or metafile.
But the Add method of the Images property takes an Image as an argument, so you could probably get an Image for the GIF file (or JPG or whatever) with Image.FromFile for example and add it to the imagelist. I have not tried it, but it could work.
-- LuisR
──────────────
Luis Alonso Ramos
Chihuahua, Mexico
www.luisalonsoramos.com
"Do not worry about your difficulties in mathematics, I assure you that mine are greater." -- Albert Einstein
|
|
|
|