In C# 7 and above, see this answer.
In previous versions, you can use .NET 4.0+’s Tuple:
For Example:
public Tuple<int, int> GetMultipleValue()
{
return Tuple.Create(1,2);
}
Tuples with two values have Item1
and Item2
as properties.
More Related Contents:
- I want to insert a record in DB and then need to return a row
- C# compiler error: “not all code paths return a value”
- Variable does not exist in the current context?
- Using a variable in another method in another class — how?
- sum up an array of integers in C# [closed]
- How to add a char every X specific char in C# [closed]
- HRESULT: 0x800A03EC on Worksheet.range
- Anyone know a good workaround for the lack of an enum generic constraint?
- How do I get and set Environment variables in C#?
- What is the best way to find all combinations of items in an array?
- JSON library for C# [closed]
- Serialize Property as Xml Attribute in Element
- How to capture screen to be video using C# .Net?
- Is there any performance difference between ++i and i++ in C#?
- Why should casting be avoided? [closed]
- Accessing a resource via codebehind in WPF
- How can I pass a pointer to an array using p/invoke in C#?
- SynchronizationContext.Current is null in Continuation on the main UI thread
- Adding Text to DataGridView Row Header
- Why is TargetInvocationException treated as uncaught by the IDE?
- If Int32 is just an alias for int, how can the Int32 class use an int?
- How could I put a border on my grid control in WPF?
- Simple JWT authentication in ASP.NET Core 1.0 Web API
- IRequiresSessionState vs IReadOnlySessionState
- Returning a void?
- Resize Controls with Form Resize
- Writing custom code for PowerPoint using leap motion?
- C# application both GUI and commandline
- Update label from another thread [duplicate]
- Partition: How to add a wait after every partition