Click here to Skip to main content
15,888,337 members
Home / Discussions / C#
   

C#

 
GeneralRe: Timer interval not change while running the windows service in C# Pin
Rajesh_K_Sharma29-Jul-09 23:29
Rajesh_K_Sharma29-Jul-09 23:29 
Questionset a font for a TextBox / c# [modified] Pin
made in 4429-Jul-09 1:13
made in 4429-Jul-09 1:13 
AnswerRe: set a font for a TextBox / c# Pin
stancrm29-Jul-09 1:38
stancrm29-Jul-09 1:38 
GeneralRe: set a font for a TextBox / c# Pin
made in 4430-Jul-09 3:03
made in 4430-Jul-09 3:03 
GeneralRe: set a font for a TextBox / c# Pin
stancrm30-Jul-09 3:14
stancrm30-Jul-09 3:14 
GeneralRe: set a font for a TextBox / c# Pin
made in 4430-Jul-09 6:25
made in 4430-Jul-09 6:25 
AnswerRe: set a font for a TextBox / c# Pin
Baeltazor30-Jul-09 19:00
Baeltazor30-Jul-09 19:00 
QuestionAccess Methods of a Class Directly Pin
Matt Clarkson29-Jul-09 1:00
Matt Clarkson29-Jul-09 1:00 
You can access the Exists method of System.IO.File class directly like so:

bool fooExists = System.IO.File.Exists("C:\foo.txt");

I have created a class that has a method in it that logs an exception to an XML file, such as:

namespace Matt.Clarkson
{
	using System;
	using System.IO;
	using System.Xml;
	using System.Security;
	using System.Windows;

	public class ExceptionLogging
	{
		public bool LogException(Exception ex)
		{
		[code for logging file]
		}
	{
}

I can access this fine with the following code:

Matt.Clarkson.ExceptionLogging foo = new Matt.Clarkson.ExceptionLogging();
try
{
	System.IO.Path.GetDirectoryName(">?|>FDA{}{}!@'#~¬");
}
catch (Exception ex)
{
	foo.LogException("Epic Fail", ex);
}

But I cannot do:

Matt.Clarkson.ExceptionLogging.LogException("Epic Fail", ex);

I understand why I cannot do the above line of code but how can i structure my classes/namespace so that i can use methods like in the .NET framework File.Exists example above. I have no need to create a new ExceptionLogging class as I just want the method inside.

I know that the above method could just be the constructor of the class but I am looking to understand the way to do this structure.

I would love to read a tutorial on this subject but I'm not even sure what this falls under? Sigh | :sigh:

Thanks for any help,

Regards,

Matt Clarkson
AnswerRe: Access Methods of a Class Directly Pin
stancrm29-Jul-09 1:02
stancrm29-Jul-09 1:02 
GeneralRe: Access Methods of a Class Directly Pin
Matt Clarkson29-Jul-09 1:05
Matt Clarkson29-Jul-09 1:05 
AnswerRe: Access Methods of a Class Directly Pin
Nagy Vilmos29-Jul-09 2:19
professionalNagy Vilmos29-Jul-09 2:19 
QuestionHow to Develop Serverless LAN chatting software? Pin
Abdullah_Hunzai28-Jul-09 23:41
Abdullah_Hunzai28-Jul-09 23:41 
AnswerRe: How to Develop Serverless LAN chatting software? Pin
dan!sh 29-Jul-09 0:42
professional dan!sh 29-Jul-09 0:42 
GeneralRe: How to Develop Serverless LAN chatting software? Pin
Abdullah_Hunzai30-Jul-09 20:18
Abdullah_Hunzai30-Jul-09 20:18 
QuestionReading a selected value from a dropdownlist nested inside the Datagridview Pin
Seabata28-Jul-09 23:10
Seabata28-Jul-09 23:10 
AnswerRe: Reading a selected value from a dropdownlist nested inside the Datagridview Pin
Nagy Vilmos28-Jul-09 23:12
professionalNagy Vilmos28-Jul-09 23:12 
Questionhow to convert .pst files to .xml files using C# programming language? Pin
tchshiping28-Jul-09 22:54
tchshiping28-Jul-09 22:54 
AnswerRe: how to convert .pst files to .xml files using C# programming language? Pin
Nagy Vilmos28-Jul-09 23:11
professionalNagy Vilmos28-Jul-09 23:11 
GeneralRe: how to convert .pst files to .xml files using C# programming language? Pin
tchshiping29-Jul-09 13:17
tchshiping29-Jul-09 13:17 
AnswerRe: how to convert .pst files to .xml files using C# programming language? Pin
Mycroft Holmes28-Jul-09 23:23
professionalMycroft Holmes28-Jul-09 23:23 
GeneralRe: how to convert .pst files to .xml files using C# programming language? Pin
tchshiping29-Jul-09 13:22
tchshiping29-Jul-09 13:22 
GeneralRe: how to convert .pst files to .xml files using C# programming language? PinPopular
Mycroft Holmes29-Jul-09 14:09
professionalMycroft Holmes29-Jul-09 14:09 
GeneralRe: how to convert .pst files to .xml files using C# programming language? Pin
situ2110-Apr-11 22:19
situ2110-Apr-11 22:19 
Questioncalling unmanaged C++ dll from C#: return type double[] Pin
devvvy28-Jul-09 22:27
devvvy28-Jul-09 22:27 
AnswerRe: calling unmanaged C++ dll from C#: return type double[] Pin
Moreno Airoldi29-Jul-09 3:13
Moreno Airoldi29-Jul-09 3:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.