Estoy creando una aplicación de consola, en la que necesito llamar a un método, que hará una lista de TRABAJOS. Pero quiero que el Método no tenga ningún impacto en la Aplicación principal, solo lo hará en sus trabajos ... eso es todo..net C#: Crear un proceso asincrónico
5
A
Respuesta
1
Tome un vistazo a this article.
muestra:
using System;
using System.Threading;
public class ServerClass
{
// The method that will be called when the thread is started.
public void InstanceMethod()
{
Console.WriteLine(
"ServerClass.InstanceMethod is running on another thread.");
// Pause for a moment to provide a delay to make
// threads more apparent.
Thread.Sleep(3000);
Console.WriteLine(
"The instance method called by the worker thread has ended.");
}
public static void StaticMethod()
{
Console.WriteLine(
"ServerClass.StaticMethod is running on another thread.");
// Pause for a moment to provide a delay to make
// threads more apparent.
Thread.Sleep(5000);
Console.WriteLine(
"The static method called by the worker thread has ended.");
}
}
public class Simple{
public static int Main(String[] args)
{
Console.WriteLine("Thread Simple Sample");
ServerClass serverObject = new ServerClass();
// Create the thread object, passing in the
// serverObject.InstanceMethod method using a
// ThreadStart delegate.
Thread InstanceCaller = new Thread(
new ThreadStart(serverObject.InstanceMethod));
// Start the thread.
InstanceCaller.Start();
Console.WriteLine("The Main() thread calls this after "
+ "starting the new InstanceCaller thread.");
// Create the thread object, passing in the
// serverObject.StaticMethod method using a
// ThreadStart delegate.
Thread StaticCaller = new Thread(
new ThreadStart(ServerClass.StaticMethod));
// Start the thread.
StaticCaller.Start();
Console.WriteLine("The Main() thread calls this after "
+ "starting the new StaticCaller thread.");
return 0;
}
}
1
Cuestiones relacionadas
- 1. XmlReader asincrónico en .NET?
- 2. ¿Cuántos modelos de desarrollo asincrónico en .NET?
- 3. Inicio del proceso asincrónico y espere a que finalice
- 4. Rx en .Net 3.5 no asincrónico?
- 5. BinaryReader asincrónico y BinaryWriter en .Net?
- 6. ¿Cómo implementar un proceso nocturno en .NET?
- 7. ¿Cómo crear un proceso en C++ en Windows?
- 8. cómo crear un gif animado en .net
- 9. Memoria máxima. Un proceso .NET puede asignar
- 10. Cómo crear un minivolcado de un proceso .NET cuando se produce una excepción de primera oportunidad
- 11. Cómo crear un proceso en Java
- 12. Crear un proceso de asistente en backbone.js
- 13. ¿Cómo crear archivos .odt con C# .NET?
- 14. AppDomains de plataforma diferente en un proceso .Net?
- 15. Copia de archivo asincrónico/Mover en C#
- 16. Cómo crear un panel transparente en C# .Net
- 17. Procesamiento asincrónico en SQL Server frente a .NET Procesamiento asíncrono
- 18. IO asincrónico en Java?
- 19. ¿Cómo matar un proceso C#?
- 20. CreateProcess asincrónico?
- 21. Conector Mysql asincrónico
- 22. Cómo llamar a una DLL .NET desde un proceso Win32?
- 23. ¿Cuál es la diferencia entre un delegado asincrónico y el método asincrónico?
- 24. Cómo detener el tcp asincrónico. El código .NET no consume todos los recursos de un sistema
- 25. hay biblioteca multiplataforma para llamar/crear proceso en C++
- 26. ¿Cómo se mata un proceso para un usuario particular en .NET (C#)?
- 27. Iniciar un proceso .Net como un usuario diferente
- 28. iniciando un proceso desde un servicio Windows .NET
- 29. Existe un límite de memoria para un solo proceso .NET
- 30. ¿Cuál es el proceso de crear un lenguaje interpretado?
Y qué esos puestos de trabajo se parecen? ¿Alguna información compartida? –