|
To call the base implementation from a derived class use: base.Foo()
The as keyword is a type of cast operator, where null is returned if the case fails. The other type of cast operator (class_name_here) will throw an exception if the cast fails.
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
Do you mean to say, I need to *instantiate* a base class object and then call the foo() method on it? That is too much of a trouble as compared to base::foo() way of C++
|
|
|
|
|
|
_l_Salil_l_ wrote:
Do you mean to say, I need to *instantiate* a base class object and then call the foo() method on it?
No.
class A
{
virtual void Foo(){}
}
class B:A
{
override void Foo()
{
base.Foo();
}
}
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
Thanks... It took a while to make out that 'base' is a C# keyword.
|
|
|
|
|
Hi,
I have 5 years experience in VC++, MFC and C++. Now I want to do programming in .Net framework. Which is best among C#, VB.Net and VC++ 7.
Which books should I refer for C#?
Thanks,
Vicky
|
|
|
|
|
Vicks wrote:
Which is best among C#, VB.Net and VC++ 7
That's a difficuly question without more information.
Since you've got a C++ background, I'd drop VB.NET from the list and concentrate on examining C# Vs. Managed C++ (I'm assuming you actually meant Managed C++ and not "normal" VC++)
If you are going to do a lot of interop work the MC++ is probably better. If not then I'd go with C#. C# is fairly close to C++ syntax. There are some differences (like the struct keyword has different meanings)
Vicks wrote:
Which books should I refer for C#?
Looks like you've already chosen C# anyway. There are lots of good books on the subject. I bought mine 2+ years ago so there are probably better introductory books by now. However I found "Applied Microsoft .NET Framework programming" by Jeffrey Richter to be a good source of information.
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
There is not a declared ‘best’ and people tend to rate them based on their own likings. In .net code written in any language ultimately gets executed in an IL on the CLR. So one should choose ‘his’ language of choice in .Net based on
a. The past experience
b. The nature of applications to be developed
I come with a similar tech background as yours and I found C# to be a more natural progression of my skill set. C++.net was also an alternative, but it will be best suited if I'm into lot of unmanaged code and/or want a quicker port of the older code. For fresh projects, C# is recommended.
|
|
|
|
|
hi,
Professional C# 2 nd Edition by Wrox is good.
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
|
I was in your boat a couple of years back. If you have 5 solid years of C++ (meaning using it everyday), then C# is going to be a piece of cake. Like you, I'm a book learner and immediately thought about getting several books. I did pick up a few here and there, but most were specialized in areas that I wanted to learn (remoting, GUI, etc). I think someone with your skill set should start with the help files & Intellisense, you'll get bored with the books. What I did was come up with a project to write (in my case, it was a code snippet manager) and went for it. Just like any project, you'll come up against problems to solve and this will solidify your knowledge and allow you to begin building a code base/libraries for yourself. You really know more about C# than you think because it is so similar to C++ and you know most of the framework because of your MFC knowledge. It's just like MFC, only better and easier.
Just my opinion.
Custom Software, Custom Solutions. Yye Software.
http://www.yyesoftware.com
|
|
|
|
|
|
Hi,
can any one please help me how to update the VC++ Directories in the Options Dialog->Projects Using the EnvDTE namespace or by anyother method...using the programming interface exposed by Studio.NET
thankx in advance
waiting!
|
|
|
|
|
|
Thanks but i couldnt find this information (i.e include paths) in the vcproj or sln files, by the way i need to have it done through C# and i want it to be globally set that is the directories i add should be permenantly added to the Visual Studio.NET IDE.......
anyone please help.....
thankx in advance
|
|
|
|
|
As with most things, this is actually stored in the registry. Take a look at the HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\Version\VC\VC_OBJECTS_PLATFORM_INFO\Win32\Directories key. You may need to restart the environment (the IDE) after changing that, however.
To access this programmatically, if you look in the MSDN Online Library[^] you will find the VCPlatform object, which exposes those directories as properties. This is not in the EnvDTE.dll assembly, however. You must reference Microsoft.VisualStudio.VCProjectEngine.dll. IIRC, you should be able to cast (performs a QueryInterface on the COM component) from a Project object defined in the EnvDTE.dll assembly.
Software Design Engineer
Developer Division Sustained Engineering, Microsoft
My Articles
|
|
|
|
|
For Tools->Options->Projects it's actually stored in the registry.
Software Design Engineer
Developer Division Sustained Engineering, Microsoft
My Articles
|
|
|
|
|
If you've seen programs like "Ad Aware," or even many other programs, do you know how they make buttons that are not the typical boring box-type button. I have heard this is done using skins. But I'm not really sure how to do this, as I'm kind of a newbie to programming with c sharp. Any help or suggestions as to how I can create a more eye-pleasing button. Any help would be great. Thanks.
Stephen
|
|
|
|
|
For starting, check
http://www.nemhauser.com/presentation.aspx?id=nmi322
Sanjay Sansanwal
www.sansanwal.com
|
|
|
|
|
I've searched all my books and the Internet and cannot find a good example to read a text file into a hashtable. My text file is tab delimited as such below)and I need to load them into a hashtable as a DNS cashe...... Help.........
123.123.123.123 www.mywebsite.com
111.222.333.444 www.nowebsite.com
|
|
|
|
|
kvnsdr wrote:
I've searched all my books and the Internet and cannot find a good example to read a text file into a hashtable.
Books typically cover how to use particular mechanisms, you simply need to put the pieces together. This is a quick example method I wrote to read your file and insert the data into the Hashtable . Hope this helps.
private Hashtable GetHashtableFromFile(string file)
{
Hashtable ht = new Hashtable();
string line = string.Empty;
using(StreamReader reader = new StreamReader(file))
{
while((line = reader.ReadLine()) != null)
{
string[] args = line.Split(new char[]{' '});
ht.Add(args[0], args[1]);
Console.WriteLine("IP:{0}, Site:{1}", args[0], args[1]);
}
}
return ht;
}
- Nick Parker My Blog | My Articles
|
|
|
|
|
I like the coding. I have an error in my code that says:
"Index was outside the bounds of the array"
All I changed was using(StreamReader reader = new StreamReader(MyFile.txt"));
????????????????
|
|
|
|
|
I think you have incorrect format of input file. Somewhere there are empty strings or parts of string are not delimited with tab symbol
modify the code like this
private Hashtable GetHashtableFromFile(string file)
{
Hashtable ht = new Hashtable();
string line = string.Empty;
using(StreamReader reader = new StreamReader(file))
{
int i = 0;
while((line = reader.ReadLine()) != null)
{
i++;
string[] args = line.Split(new char[]{' '});
if (args.Length != 2)
{
Console.WriteLine("Invalid input string: " + i.ToString());
continue;
}
ht.Add(args[0], args[1]);
Console.WriteLine("IP:{0}, Site:{1}", args[0], args[1]);
}
}
return ht;
}
Invalid string will be skiped and appropriate message displayed
|
|
|
|
|
Hi,
I have 2 questions regarding property grid:
1) I am using the property grid to show properties of class. For some of these properties I need to show drop down list .For static values i can use converter but how abt for those whose values I do not know until run time ?
2) How can I implement undo/redo in the property Grid.
Please help me out
Thank you
|
|
|
|
|
1. Write your own convertor and populate the SupportedValuesCollection.
2. Im not too sure, but maybe DesignerTransactions means something
top secret xacc-ide 0.0.1
|
|
|
|