What is a source code in C#? - c#

My professor is asking me to submit my source code as my assignment in Visual Studio. I am working on a Windows Form application in C#, is my source code the actually code that I have been working on? Or is it like the background code that I don't edit or touch?
I'm only asking because my professor is completely useless when you need to ask her a question because she never replies in time and I need to submit my assignment in a few hours. I have searched the web for source code but I need a specific answer.
I don't want to read 50 pages just to find out the code I need to submit was the code I was working on. Thank you everyone for your help, I really do appreciate it.

The source code is the stuff you wrote in Visual Studio. Anything you need to actually build/compile the application is usually what we would call source code. You need to make sure your professor can also compile the application in Visual Studio just like you could, so send over any files that she would need to do that.

Right click on your solution file in visual studio, choose "Open the folder location". It will open the physical location of your files under the solution. Completely zip the contents in that path, submit it to him. Simple as that. You already knew it and we are making sure for you '-)

Source code is the raw code that you write when making an application or program. In short what your professor needs is your code.
Zip your solution folder which you find at
Documents => Visual Studio 2013/2015 => Projects => {name of your project}
This is the folder that you zip and send to your professor
Hope this helps.

SOURCE CODE ---> (COMPILER) ---> MACHINE CODE
SOURCE CODE :
Source code is any collection of computer instructions (possibly with comments) written using some human-readable computer language, usually as text. As a programmer you write source Code in your C# editor.
MACHINE CODE :
Machine Code is a set of instructions executed directly by a computer's central processing unit (CPU).
COMPILER :
A compiler is a computer program (or a set of programs) that transforms source code written in a programming language (C# in your case) into another computer language (the target language), with the latter often having a binary form known as Machine code.

Related

.cs file stand alone no syntax error checking at all, no library auto detection for c#

I am not new to coding and I know I have never had this issue.
In Visual Studio if I just create a .cs file and check it's intellisense nothing works. auto complete for using. does not work, nor does simple syntax checking work (see image)
Am I crazy? Can someone else try this out, what am I missing?
NOTE this only happens when I just have a .cs file for an external script. I just need simple auto complete and syntax checking to work
A C# file is somewhat meaningless without a project file. Versions, references, etc… all depend upon having a build system. This is a somewhat pedantic truth, but it is how VS works. Pathologically, I could have a CS file Console.WriteLine(“Hello world!”); which in one project results in hello world, and in another results in the program formatting a disk.
Add the CS file to a project, or create one. If you frequently come across this issue in some unique use case, visual studio may not be the best editor for the job. VS Code or another more lightweight tool may be better suited.

Why are source code seen in exe as it is supposed to be binary?

Recently I did an experiment with one of my c# .NET compiled exe by renaming the extension to .txt.
When viewed in the Notepad, I was able to see all my source code in English Language which made me confused if I was looking at a .cs file or a .exe file.
After this event I realized that anyone who has this exe can copy all the codes an re-compile them into a clone with some hidden additional codes (or malwares) that could harm my reputation among users.
However I know a little about obfuscation which can rename all methods and properties into a non-human readable format, still I would like to ask here, isn't an exe program supposed to be (only) in a computer readable binary format (as I have learnt in school)? Why is there a need of obfuscation additionally? Is this problem only limited to exe which has a CLR header? Should I consider creating applications on other languages like C, if I want to make it hard to decompile?
Please Answer...
Edit:- Most of the codes can be seen in this area and I am unaware of what part of the source code it consists of.
Edt:- Also when I do the same with an exe that is compiled using Visual Foxpro (where Encrypted is checked in Project Properties), not even a single readable text is seen except some assembly infos. What encryption technique is used in it, can we use it (or like that) in dotnet (free or paid)?
Source - https://www.tek-tips.com/viewthread.cfm?qid=286147

C# view source code of a particular .NET class

I browsed through some questions and this one stood out as the better one:
.Net Classes and their source code which pointed me to this place here: Microsoft Reference Source Server.
I tried everything the site says, downloaded a file that I cannot open from there and at some point ended up with a .pdb file in my source folder for the symbol cache that I could not open with a multitude of tools I looked into.
So this is my last resort to find an answer to my question. Out of pure curiosity (and lack of a better way to understand some stuff) I want to open a particular class from Microsoft (namely I wanna look into RichTextBox and maybe the classes it inherits from) but I simply cannot find a way to make this work for me. I want the original source, not a decompiler product because, well because I mainly need to understand some stuff, not see random variable names. I appreciate any help that may get me around my stupidity and clumsiness, as well as the right tools to do so (if any other than VS).
Note that I am using Visual Studio 2012 and yes, I went over a guide covering this specific version instead of the guide on VS 2008.
The "download" links on this page: http://referencesource.microsoft.com/netframework.aspx should work. However try downloading them via Internet Explorer; my Firefox attempted to download an .aspx file instead of the installer itself for some reason. (EDIT: as #ParagMeshram pointed out, just rename the netframework.aspx to netframework.msi as a quick fix if necessary)
In addition, here's a link to the source hosted by dotnetframework.org: http://www.dotnetframework.org/default.aspx/4#0/4#0/untmp/DEVDIV_TFS/Dev10/Releases/RTMRel/wpf/src/Framework/System/Windows/Controls/RichTextBox#cs/1305600/RichTextBox#cs
I can't say for certain if it's the latest greatest, or what you would be compiling against exactly, but should give you a good idea of how it works.

How to write and testing ASP.NET 4 on notepad?

Conditions:
I've been asked to develop a simple ASP.NET 4(C#) project in notepad. I'm completely new to this area.
The completed project should include several .aspx files, one master page, one sitemap and a web.config.
The book I'm using is a beginner cook book, based on using Visual Studio 2010 Express.
Developing it on notepad is a requirement to this school assignment.
Questions:
As what I know now VS2010 has its built-in Development Web Server which notepad doesn't. Should I test .aspx files by opening notepad files in browser? Will tags with runat="server" work?
Is there any helpful site or post that you know?
How should I testing master page?
Forgive my noob questions. The most sites I can find is teaching people how to develop by using VS2010, which is like my book, instead of notepad. The schedule is tight so I need some help here. Thank you for your time. I'll also share my experience when I finish this assignment.
It's a little more complicated than "runat="server"".
To give a little bit of 101, you will need:
A web server. The most natural one to use is IIS. I believe you should be able to use Apache as well if you're feeling adventurous.
The application framework. Guess what, it's .NET! There's also Mono if you're not using IIS. The application framework should also include the compiler. C# is a compiled language, so before you can run the code, you will have to compile it first. This is slightly different when compared to PHP.
The editor. You should be able to use Notepad, but Visual Studio provides you with more than just a fancy text editor. It helps you create the build script (the command that you send to the compiler), it helps you with project organization, and it helps you debugging.
So just using Notepad is doable, but you'll lose so much time for not using a free tool like Visual Studio Express.
Now to actually answer your questions:
No, it doesn't work that way. You will need a web server (see point 1 above) and a compiler (see point 2 above).
That's a little bit too broad. Your book should be a good starting point.
See answer 1.
I have finished that assignment. Here is my experience:
First, to develop an ASP.NET project on notepad or textpad is very unwise, unless you want to test your coding skill or having some other reasons. Because for beginner the best way to test your code is using VS "Ctrl+F5". If you write your code in notepad/textpad and test them in VS, it kind of defeat the original purpose.
There is a few tips, for the beginner like me.
Named your sitemap file "web.sitemap", and put it in the root directory of your project, otherwise you may have to go through complicated configuration process.
P.S. This is not a compulsory requirement, you can change the file name or directory, but you need to add site map provider in "web.config".
2 Choose your solution or project root directory carefully, because it is not easy to redefine it.
P.S. I spent a lot of time to move files around in Windows Explorer because I wanted to change my current solution directory to another folder.
These are the tips I find most useful. I would've saved at least 2 hours if I know these in the beginning.

Visual Studio 2008 C# - Recover solution from application manifest possible?

Hello I recently deleted what I thought was an unused folder which happened to have the solution and code for a windows application I am maintaining.
I have published the app multiple times with ClickOnce and have access to the application manifest, deploy, etc. Is there a way for me to use the published application to get back my solution?
Thanks
If you don't currently use source control, I would highly recommend using one. I'm not aware of a way to get back all the solution files without source control, but you can get back the code using .NET Reflector. There is a file disassembler add-in which allows you to dump the code straight out of Reflector.
not possible. you can't recover the solution and original code from the compiled and deployed version.
if you have not used that machine or hard drive since you deleted it, you may be able to recover the files but it's a long shot and may be expensive.
you need to invest some time in learning source control. git, mercurial, subversion... they're all free and easy to use in windows. having your code in source control would prevent this problem - delete it all you want, just do a checkout from source control again.
Just go get the project back from Subversion.
Basically all you can do at this point is feed the assemblies to a program like reflector and reverse engineer it back. Welcome to sucksville.
If you don't have your stuff in some type of repository already I'd highly recommend fixing that first thing in the morning. With free tools like subversion available, nevermind things like TFS or even VSS there just isnt a good excuse.

Categories

Resources