Posts Tagged ‘c’


 

Validation are utmost important part of a software product. It is important to validate the data that is going into the system at each and every layer. By each and every layer I mean it is important to have validation in place on client side, server-side and even database level.

(more…)


The below method fetches the path for all the files present in a Directory or Sub Directory under the parent Directory.
The file path are fetched in a list of string to be used for any implementation as and when required.


private List DirSearch(string sDir)
{
List files = new List();
try
{
foreach (string f in Directory.GetFiles(sDir))
{
files.Add(f);
}
foreach (string d in Directory.GetDirectories(sDir))
{
files.AddRange(DirSearch(d));
}
}
catch (System.Exception excpt)
{
//throw ex
}

return files;
}


Below is the simple method that can be used to fetch file names of all the file present under a File Directory.


private static string[] GetFileNames(string path, string filter)
{
string[] files = Directory.GetFiles(path, filter);
for (int i = 0; i < files.Length; i++)
files[i] = Path.GetFileName(files[i]);
return files;
}

This code is designed in such a way so that we can obtain filename according to filetype.
If I provide ‘*.*’ as an input to filter, all the file names will be obtained in string array, but if I obtain ‘*.jpg’ as an input the string array will contain file names for all ‘.jpg’ files.

Example:

string[] fileNames = GetFileNames(@"C:\Users\Public\Pictures\Sample Pictures", "*.jpg");


In this article I will provide you with a quick reference in order to create proxy file in ASP.Net.

Here we will be using svcutil.exe provided by .Net framework to create proxy file at the specified location.

(more…)


This article will explain you how to convert a MVC3 application to MVC4 application in Visual Studio.

asp-dot-net-logo

On high level the changes mostly are with respect to web.config and the dll that are included in our project.

ASP.NET MVC 4 can be installed side by side with ASP.NET MVC 3 on the same computer, which gives you flexibility in choosing when to upgrade an ASP.NET MVC 3 application to ASP.NET MVC 4.

(more…)


Here is a simple method that returns the data in List object to be downloaded as an CSV file.

(more…)


Here are some questions for C# developers to prepare for there interviews.

(more…)