|
I think you might need to go back to basics and read up on the fundimentals of .Net.
You can have two different types of type, one is reference types, the other is value types.
By default reference types are passed by reference and value types are passed by value.
Classes are reference types and structs/primatives are value types.
If you don't understand any of this buy any beginner .Net book and it'll be in the first few chapters
As for best practice ... use what is needed.
|
|
|
|
|
Ahh - I think I see what you are getting at. .NET differs from VB (6) in that it passes parameters by value and not by reference.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Suppose ...
public interface IMyInterface{<br />
void MyMethod();<br />
}<br />
<br />
public class ClassA:IMyInterface{<br />
public void MyMethod(){}<br />
}<br />
<br />
public class ClassB:ClassA,IMyInterface{<br />
public void MyMethod(){}<br />
}<br />
Can anyone tell me if it's required to specify that ClassB inherits IMyInterface ?
The interface is to my opinion inherited through the base class ClassA, but it seems
specifying (or not) the interface inheritance in the derived class ClassB makes no
difference.
|
|
|
|
|
You dont need to unless u want to 'override' the behaviour. This normally means you have designed something wrong
To override the interface implementation, you would likely have to use an explicit implementation.
|
|
|
|
|
Indeed I want to override (reimplement) the interface behaviour in the derived ClassB,
but my question really is wether to use ...
public class ClassB:ClassA,IMyInterface
or
public class ClassB:ClassA
as the ClassB declaration ?
Both work for me, but I was wondering if there's a difference
(behind the scenes ?) for either one of them !
|
|
|
|
|
hi all
how i can to calculate the width of the text
i means of width of text is not the number of char in text
i mean the width of this text the width for each of text
Thaer
|
|
|
|
|
The System.Drawing.Graphics object has a MeasureString method
|
|
|
|
|
hi
in a form or control do this:
using(Graphics g = this.CreateGraphics())
{
SizeF textSize = g.MeasureString("mytext", Font);
}
regards
|
|
|
|
|
when user press F12, my prg will open a new form showing screen shot.
how could i code?
i used keypreview, keyup event.
it works just if the main window is activated, or not it doesnt work.
is there any easy way without writing a win. service.?
|
|
|
|
|
No. I'm not even sure a service will do it, you need a system wide keyboard hook
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Please suggest any way that enables me to CAB and UNCAB files via c# application...
|
|
|
|
|
Please don't repost questions so quickly - it's quite rude. People here give their time freely, and will get to you when they can. So please, be patient.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
|
I assume it's either the impatience of youth, or he forgot to put Urgent. Plz Help... in the post.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I have replied him in his original thread itself. There was a direct CP article that was befitting his requirement.
|
|
|
|
|
I like to know how to keep track of person logged on to the system after postback of a page!.Or to carry information of a person logged on to the system through different pages.
|
|
|
|
|
one method is to use the session
Session.Add("username",myuser);
darkhero
|
|
|
|
|
I want my application main form to contain a lot of forms that will be open by the user (press on button's).
I want some main form that will by fill the container of the form .
My container is MdiParent but my problem is that if the user drag the form out of the border the container is expand.
how can i block the continer to be at the size of the visual state ?
Shai Sherman
|
|
|
|
|
|
Please don't repost so quickly. It's generally considered to be quite rude.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
You've been told once already: Do your own homework?
We are willing to help if you show what you have tried to do and then we can help to show you where you went wrong and how to fix it. However, you have not shown any attempt at the problem that you are having difficulty with yet.
|
|
|
|
|
That code does not represent the problem. For a start your problem statment requires TWO inputs. Where is the other one?
|
|
|
|
|
Gotta love people who delete all their posts.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: Gotta love people who delete all their posts.
Yep, now I am very curious to what it was. That is why I usually highlight the post in my reply, so it is there even if they delete theirs
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
dianenacario wrote: How can I modify this?
console.write("input integer:");
int i= int.parse(console.raedline());
int x=1;
for(int y=1; y=i; y++)
{
x=x*y;
}
console.write(x)
console.readkey();
This does not even fulfil the requirement before specification that the * operator is not to be used. It quite specifically states that the program must take 2 user inputs. Yours only takes 1.
Change this to take 2 inputs and get it working using the * operator. You will at least get partial credit even if you cant work out how to get the 2nd loop to do the job of the * operator.
Aside from that, requirements like this are not too dissimilar in the real world. Albeit that we don't ban the use of a particular operator, sometimes constraints are placed on you that you must adhere to. This goes for all jobs - not just programming.
|
|
|
|