|
If you are asking how to begin what you want to do, have a look at the System.Net.Sockets.Socket class, and try searching Codeproject site for articles. You'll find everything there.
There are 10 kinds of people: those who understand binary and those who don't
|
|
|
|
|
hi all
i have a txt file a.txt inside the folder D:\myolder\urfolder\folder\a.txt
is ther any option to read the name of urfolder.i know only the name of the txt file. want to find the folder name. i know we can find the path by string path = Path.GetFullPath("a.txt"); but i want only the middle folder.
plz help me
plz....
i tried using substring, but the folder name length differs....
so that is also not possible
plz do help me
|
|
|
|
|
use the following code...
System.IO.DirectoryInfo di=System.IO.Directory.GetParent(@"D:\myolder\urfolder\folder\a.txt");
string middledirectory=di.parent.Name;
Koushik
|
|
|
|
|
Hi.
I have a C# app that I wrote in Visual Studio, in Windows. There are a few libraries that my code needs to use, and they were written in C, in Linux. I am totally new to this. Is there an easy way to either convert the C code to C#, or to allow my C# app to access the C code? I tried compiling the C code in visual studio, but some of the libraries included are *nix based/specific, and I don't know their counterparts in Visual Studio under Windows.
|
|
|
|
|
Hi I am preparing for interview for Motorola on C#, Please suggest me for some sites or forums where I can get interview questions and answers.
Actually I searched in google, but couldn't get clear cut answer.
I have few questions
Difference between Debug and Release?
What is Doc Switch?
Can you brief me about Generics and Partial Classes.
What are static classes?
what are indexers in C#?
What does immutable mean?explain?
how to create a singleton class(A class to which only one instance can be created throughout the application)
And finally Please tell me what is Type Safety (in C#)
Thanks,
Prashanth
|
|
|
|
|
Have you considered learning the answers to these questions yourself?
I think it's a bit cheeky to ask people on this forum for the answers to interview questions to help you get a job. Especially when the questions are fairly basic and a quick search on MSDN would have yielded the results.
Paul Marfleet
|
|
|
|
|
Hi Prashanth.
Please take a look at these answers:
1. Debug build contain debug symbols and can be debugged while Release build doesn’t contain
debug symbols and hence cannot be debugged.
When an application is built using Debug build, a .pdb file is generated in the bin folder
while this does not happen in Release build.
There will be a speed difference, because of disabling debug methods.
2. Instance methods are associated with an object and use the instance variables of that
object. This is the default.
Static methods use no instance variables of any object of the class they are defined in. If
you define a method to be static, you will be given a rude message by the compiler if you try
to access any instance variables. You can access static variables, but except for constants,
this is unusual. Static methods typically take all they data from parameters and compute
something from those parameters, with no reference to variables. This is typical of methods
which do some kind of generic calculation. A good example of this are the many utility methods
in the predefined Math class.
Ramorua
|
|
|
|
|
pashitech wrote: What is Doc Switch?
He's the replacement for General Access Violation. As you know, .NET runs in a managed environment so it protects you from accessing memory area that you shouldn't using a process called Memory Switching. The nickname for the feature that does this is called Doc Switch (the Doc being short for Doctor).
pashitech wrote: what is Type Safety
It's the set of tests (a bit like Euro NCAP) that saves your application if it crashes.
pashitech wrote: Difference between Debug and Release?
Debug is the process of getting software into the beta phase. Once it's ready to roll, you move it to the Release phase.
If you liked these answers, the please let me know so that I can give you other wrong answers to more stupid questions. Alternatively, why the hell don't you actually get off your a*se and do some research yourself. There's this wonderful tool - called Google - that would answer these questions and more. More importantly, it would give you a valuable life skill - the ability to actually look something up for yourself instead of wanting others to do your thinking for you.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
pashitech wrote: Difference between Debug and Release?
The biggest difference between these is that:
In a debug build the complete symbolic debug information is emitted to help while debugging applications and also the code optimization is not taken into account.
While in release build the symbolic debug info is not emitted and the code execution is optimized.
Also, because the symbolic info is not emitted in a release build, the size of the final executable is lesser than a debug executable.
One can expect to see funny errors in release builds due to compiler optimizations or differences in memory layout or initialization. These are ususally referred to as Release - Only bugs
In terms of execution speed, a release executable will execute faster for sure, but not always will this different be significant.
pashitech wrote: What is Doc Switch?
that gathers all such documentation lines and generates HTML reference pages."
According to 'csc -?' the '/doc:<file>' switch is for "XML Documentation file to generate", not HTML. (I could find no reference to HTML under csc -?) Also, the only Output option in VS Express (Project -> MyPhotos Properties ... -> Build tab -> Output) was for "XML documentation file:" After rebuilding the project I inspected the directory structure and found a XML file; there was no HTML file(s).
pashitech wrote: Can you brief me about Generics and Partial Classes.
Generics and Partial classes
pashitech wrote: What are static classes?
A class can be declared static, indicating that it contains only static members. It is not possible to create instances of a static class using the new keyword. Static classes are loaded automatically by the .NET Framework common language runtime (CLR) when the program or namespace containing the class is loaded.
Use a static class to contain methods that are not associated with a particular object. For example, it is a common requirement to create a set of methods that do not act on instance data and are not associated to a specific object in your code. You could use a static class to hold those methods.
pashitech wrote: what are indexers in C#?
C# introduces a new concept known as Indexers which are used for treating an object as an array. The indexers are usually known as smart arrays in C# community. Defining a C# indexer is much like defining properties. We can say that an indexer is a member that enables an object to be indexed in the same way as an array.
<modifier> <return type=""> this [argument list]
{
get
{
// Get codes goes here
}
set
{
// Set codes goes here
}
}
pashitech wrote: What does immutable mean?explain?
An object qualifies as being called immutable if its value cannot be modified once it has been created. For example, methods that appear to modify a String actually return a new String containing the modification. Developers are modifying strings all the time in their code. This may appear to the developer as mutable - but it is not. What actually happens is your string variable/object has been changed to reference a new string value containing the results of your new string value. For this very reason .NET has the System.Text.StringBuilder class. If you find it necessary to modify the actual contents of a string-like object heavily, such as in a for or foreach loop, use the System.Text.StringBuilder class.
pashitech wrote: how to create a singleton class
http://dotnetslackers.com/community/blogs/simoneb/archive/2007/04/17/ASP.NET-Singleton_2D00_per_2D00_Page-pattern.aspx[^]
SSK.
Anyone who says sunshine brings happiness has never danced in the rain.
|
|
|
|
|
pashitech wrote: Please suggest me for some sites or forums where I can get interview questions and answers.
There are hundreds of them containing millions of questions. If you can memorise all of these then I would recommend that you actually learn your subject area instead as it would be much more beneficial to you than learning to parrot an answer.
pashitech wrote: Actually I searched in google, but couldn't get clear cut answer.
There is no clear cut answer. Every interview is different and depends on what the company is looking for.
pashitech wrote: I have few questions
Difference between Debug and Release?
What is Doc Switch?
Can you brief me about Generics and Partial Classes.
What are static classes?
what are indexers in C#?
What does immutable mean?explain?
how to create a singleton class(A class to which only one instance can be created throughout the application)
And finally Please tell me what is Type Safety (in C#)
You should know most of these already if you are going for a job as a software developer. If you come to us and pull the wool over our eyes in the interview and we hire you, you'll be booted out the door quick enough when we realise you were faking it.
Do NOT try and hoodwink the interviewer. You will end up with a poor reputation.
|
|
|
|
|
Colin Angus Mackay wrote: Do NOT try and hoodwink the interviewer
Just kicked somebody out of an interview because they tried to bull me. Asked a simple question about interface inheritance and they went off onto a long waffling answer to try and hide the fact that they didn't know. I'd have been more impressed if they actually came out and said they didn't know.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
You should come down to DDD6[^] in November - I'm doing a session on recruitment (assuming it gets voted in)
|
|
|
|
|
If I can make some time in the schedule, I'll try to get down.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
The Ibis has a good weekend offer on. £39 per night (Check in Friday, Check out Sunday). The Novotel next door is £59 per night B&B (Fri-Sun). I stayed there (Novotel) last weekend for SQL Bits.
|
|
|
|
|
Colin Angus Mackay wrote: Novotel next door is £59 per night B&B (Fri-Sun). I stayed there (Novotel) last weekend for SQL Bits.
What's it like? The last Novotel I stayed in was noisy to say the least.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Pete O`Hanlon wrote: What's it like? The last Novotel I stayed in was noisy to say the least.
I suppose it depends on the other guests. I stayed in a hotel once for 6 months. Sometimes I was noisy, sometimes not.
|
|
|
|
|
I need to change the color of the horizontal and vertical scroll bars in a DatagridView. Can anyone help me?
Thanks
|
|
|
|
|
Hey how can i see who are all online and within how much minimum time my question will be answered..this is the first time i logged into the site...asking this out of my curiosity
|
|
|
|
|
Skeliton wrote: how can i see who are all online
You can't. Code Project considers this to be a privacy issue and doesn't show you which members are currently online.
Skeliton wrote: within how much minimum time my question will be answered
There is no minimum time. Everyone here answers questions on a volunteer basis. Some questions may get answered fairly quickly while others might not get answered at all.
Skeliton wrote: this is the first time i logged into the site
Welcome to the site. For your own benefit, and to help make sure questions get answered, you might want to read the following Forum Guidelines.
|
|
|
|
|
I have 3 ImageButton controls have ID : IB1, IB2, IB3.I use Source object for them :
public void doImage(object Source, ImageClickEventArgs E)<br />
{<br />
switch (Source.ID)<br />
{<br />
case "IB1":<br />
Response.Redirect("ibtest.aspx");<br />
break;<br />
case "IB2":<br />
Response.Redirect("another.aspx");<br />
break;<br />
case "IB3":<br />
Response.Redirect("third.aspx");<br />
break;<br />
}<br />
<br />
}
This code is noticed that wrong : 'object' does not contain a definition for 'ID'.But I don't know how to repair.Someone help me, please !
nothing
|
|
|
|
|
Since everything is an ImageButton, you need to cast source back to an ImageButton:
public void doImage(object source, ImageClickEventArgs e)
{
ImageButton ib = source as ImageButton;
if (ib != null)
{
switch (Source.ID)
{
case "IB1":
Response.Redirect("ibtest.aspx");
break;
case "IB2":
Response.Redirect("another.aspx");
break;
case "IB3":
Response.Redirect("third.aspx");
break;
}
}
}
public void doImage(object source, ImageClickEventArgs e)
{
ImageButton ib = source as ImageButton;
if (ib != null)
{
switch (ib.ID)
{
case "IB1":
Response.Redirect("ibtest.aspx");
break;
case "IB2":
Response.Redirect("another.aspx");
break;
case "IB3":
Response.Redirect("third.aspx");
break;
}
}
} [modification at 5:37 Tuesday 9th October, 2007] As Martin# pointed out, I forgot to change the switch to use the casted source .[/modification]
|
|
|
|
|
My code in C#.I haven't solved my problem yet.It's still wrong.
nothing
|
|
|
|
|
Does the code not compile? Does it not run properly? Just saying "it's still wrong" doesn't provide a lot of information to work with. Have you stepped through the code in a debugger and looked at the value of sender ?
|
|
|
|
|
Debugger. Step through. What is this strange language you speak? Don't you know that we are here to do peoples bidding and just give them the answer to their problems without them having to tell us what they actually are? Apparently the magic elves aren't doing their jobs properly.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Pete O`Hanlon wrote: Apparently the magic elves aren't doing their jobs properly.
I guess they were a little distracted...or tired from jumping through hoops so many times.
|
|
|
|