|
Hello,
My name is Aaron Thompson. I am a student at Columbus State Community College in Columbus Ohio. I am currently seeking an AAS of Computer Programming Technology, but I have just started into the world of programming, so my experience is very limited. I am currently working on a report about C#, and needed to get some primary research data. I have done a good deal of research into what C# is about, but I am still very much the novice. The report is for my Business English class, and does not have to be overly technical. I have a few questions that I have come up with, and any responses would be greatly appreciated. If possible could I have responses by Friday March 1st? If you would like to send your response to my hotmail account, it is aroconthom@hotmail.com.
If you could also leave your name and an email address for reference information that would be great. If you would not like to be referenced, your response is still very much welcomed. Thank you in advance for any help I receive.
1) What features of C# do you find to be the most useful to you when writing programs? Please list 3-5 features for your answer.
A few examples of what I would consider features of C#: The garbge collection mechanism, access to the .NET libraries for easier inheitance of code, and the ability to manage memory yourself by declaring a section of code as "unsafe".
2) What features would you consider to be the least useful to you when writting programs in C#? Please list 1-3 for your answer.
3) What previous programming languages experince do you find the most helpful when learning to use C#?
Such as profficiency with Visual Basic, C, C++, JAVA, etc.
|
|
|
|
|
Aaron T. wrote:
What features would you consider to be the least useful to you when writting programs in C#? Please list 1-3 for your answer.
Managed code/garbage collection...
No direct and easy access to the Windows API
No "real" pointers
I can't compile native applications
Aaron T. wrote:
What previous programming languages experince do you find the most helpful when learning to use C#?
Such as profficiency with Visual Basic, C, C++, JAVA, etc.
I have programming C++ for a looong time, and some years ago I also programmed in Delphi, both have been very usefull when trying out C#.
(Delphi and C# is both designed by Anders Hejlsberg, and several features in common)
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Thank you so much for your response, it will help a great deal. From everything that I have read experince in C++ will make learning C# the easiest. Doing this paper has helped me to get a direction of what areas I want to concentrate on in programming.
Have a great day,
Aaron T.
|
|
|
|
|
Hi All,
I have just finished creating a small application and now am trying to package it into a setup program so that I can distribute it to the people concerned.
Where is the nice easy package creator program? or what am I supposed to do now?
Thanks,
|
|
|
|
|
If you are using VS 6.0 then it comes with a version of InstallShield that you can use to package your distribution.
If not then I would suggest getting a trial for any of the commercially available packages of trying the Windows MSI installer if your package warrants this complexity. Otherwise search google for shareware installer packages and give them a try. I have seen many over the years and it really depends on how complex your application is with regard to dependent components, license installation, registration, uninstall, user input and control of installation, etc.
Success is measured by ones ability to mask complexity with simplicity.
|
|
|
|
|
Sorry forgot to mention that I am using C# and VS.NET Beta 2 (still waiting for my retail version to arrive in the UK).
I have the package installer that comes with VS 6.0 but it doesn't accept my C# project as a project?
Thanks,
|
|
|
|
|
Within VS.NET go to File -> Add Project -> New Project then select the Setup and Deployment option and choose Setup Project or the Setup Wizard. Follow the steps and it will create a MSI install package for you.
|
|
|
|
|
There we go, I knew there had to be a simple smart way ...
You have made my day..
Cheers
|
|
|
|
|
Just wondering how to inherit 2 classes in c#?
Anyone there could provide some example code?
|
|
|
|
|
If you're referring to multiple inheritence (mi), it is not supported in C#. However, in addition to inheriting from a single class you can also inherit from as many interfaces as you like.
Cheers,
Tom Archer
Author, Inside C#
|
|
|
|
|
Hi, I've created a C# dll using the Class library project and have a method in there that just returns a string. I'd like to import this dll in my code dynamically instead of doing the "Add reference". How would I do that? Any help would be greatly appreciated.
|
|
|
|
|
I personally have not tried this, but this might point you in the right direction:
Try assem = System.Reflection.Assembly.Load(...) to load your assembly (C# dll).
Then t = assem.GetType(...) to get your type (class, etc.)
Then use t.InvokeMember(...) to call a method
You can also get a ConstructorInfo object through the Type object and create an instance of your class through ConstructorInfo.Invoke(...)
--
Peter Stephens
|
|
|
|
|
*sigh* I should have reloaded the forum before I started typing my post :-P
James
Sonork ID: 100.11138 - Hasaki
"My words but a whisper -- your deafness a SHOUT.
I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
Yes, but yours has better examples
--
Peter Stephens
|
|
|
|
|
First you use Assembly myAssembly = Assembly.LoadFrom(myDllPath); passing in the location of your dll.
Next you use the returned Assembly and search it for the Type you want to use (Type is the overlying type for all classes, enums, structs, delegates, and events). Type myType = myAssembly.GetType("myNamespace.myType"); .
Now with your type you can create an instance of it. object myInstance = Activator.CreateInstance(myType);
Now comes the fun part, invoking your method!
string retVal = (string) myType.InvokeMember("MyMethodName", BindingFlags.Public | BindingFlags.InvokeMethod, null, myInstance, new object { /* any parameters here, leave empty if there are none */ } );
There you have it! You've not successfully run a method and retreived the return value.
To sum it up again,
Assembly myAssembly = Assembly.LoadFrom( myDllFilename);
Type myType = myAssembly.GetType( myTypeName);
object myInstance = Activator.CreateInstance( myType);
string retVal = (string) myType.InvokeMember(
"myMethodName",
BindingFlags.Public | BindingFlags.InvokeMethod,
null,
myInstance,
new object { }
); HTH,
James
Sonork ID: 100.11138 - Hasaki
"My words but a whisper -- your deafness a SHOUT.
I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
Thanks guys. Great help
|
|
|
|
|
hello
is there any way to determine what exception has been thrown ?
i have a try and catch block catching Exception all the time, but id like to know what type of Exception is thrown for an object that throws one, so i know what to catch.
|
|
|
|
|
The documentation should tell you what exceptions to expect, but you can get the name by doing the following
catch(Exception e) {
string name = e.GetType().Name;
Console.WriteLine("Exception: {0}", name);
}
Or just take the catch out altogether and the framework will catch it, in the description it should give the name of the exception.
James
Sonork ID: 100.11138 - Hasaki
"My words but a whisper -- your deafness a SHOUT.
I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
public const byte[] FOO = {0x00FF, 0x00FF, 0x00FF,
0x00FF, 0x00FF,0x0074,
0x0001, 0x0003,0x0075,
0x0003, 0x0000};
I get a complie error
Array initializers can only be used in a variable or field initializer. Try using a new expression instead.
And yes i have tried using new, i cant get that either, someone help me plz ?
|
|
|
|
|
hmmm, seems like a stupid problem; the compiler should be able to take care of that or so I would think.
This does the trick though, hope it helps.
public static readonly byte [] FOO = new byte[] {
0x00FF, 0x00FF, 0x00FF,
0x00FF, 0x00FF,0x0074,
0x0001, 0x0003,0x0075,
0x0003, 0x0000
}; James
Sonork ID: 100.11138 - Hasaki
"My words but a whisper -- your deafness a SHOUT.
I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
You can only use 'const' on simple values that can be computed at compile time. For example, assigning a fixed value.
Your code wants to do something more complex which involves creating a new object. Just because we can see it is fixed does not mean the compiler can.
Therefore you need to use 'readonly' instead of 'const' to get the same effect.
Phil Wright
uk_phil_wright@hotmail.com
|
|
|
|
|
What is the difference between the 'bin' and 'obj' directories in which your source files are located for VS.Net ?? It seems the contents are very similar (ie. an .exe file located in both locations after a build)
thanks in advance
Soliant
|
|
|
|
|
I believe the bin directory contains the final output, while the obj directory contains any temporary files (compiled .resources), vs.net temp files, and the like.
James
Sonork ID: 100.11138 - Hasaki
"My words but a whisper -- your deafness a SHOUT.
I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
I am having quite a time trying to add a resource file to my project in
VS.NET. I've been scouring the help docs and I can't for the life of me figure out
what I'm doing wrong. Ideally, I'd like to find a link somewhere that walks me through, step by step, in creating a resource file (and explaining the advantage/disadvantages & difference in using a .resource or .resx file), adding it to your project and finally accessing the resources within that resource file.
Here's my issue... I have a resource file called Icons.resources (created with a freeware app I found... saves the resource as a .resource/resx file).
I have added it to my project and set it's properties to "Embedded
Resource"... but everytime I compile it, I get the following error:
Additional information: Could not find any resources appropriate for the
specified culture (or the neutral culture) in the given assembly. Make sure
"Icons.resources" was correctly embedded or linked into assembly "Picture
Utility".
baseName: Icons locationInfo: <null> resource file name: Icons.resources
assembly: Picture Utility, Version=1.0.783.28733, Culture=neutral,
PublicKeyToken=null
I have also been going through a program that does
the exact same thing I'm doing and can't seem to find the difference between
his and mine and what I'm doing wrong.
Thanks in advance
Andrew Connell
IM on MSN
andrew@aconnell.com
|
|
|
|
|
I got it... for those of you that have the same problems...
When I created my resource file ("Icons.resource") and added it to my project ("PictureUtility") as an embedded resource, I needed to access it by the name the project would understand... which is "PictureUtility.Icons".
Just posted by success story in case others have the same problem.
-AC
Andrew Connell
IM on MSN
andrew@aconnell.com
|
|
|
|
|