© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
Search
Star
Feedback
Setup for Free
C
C#
•
4y ago
•
15 replies
Binto86
set default value of parameter to other parameter [Answered]
ok
, i am aware that this is probably not possible
, but can i set default value of parameter x to value of parameter y
?
consider this example
:
public void MyMethod(string x, string y=x)
{
//some code
}
public void MyMethod(string x, string y=x)
{
//some code
}
would this be possible
?
C#
Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Similar Threads
Was this page helpful?
Yes
No
Recent Announcements
Similar Threads
Default struct with default value [Answered]
C
C# / help
4y ago
✅ How to set enum default int value
C
C# / help
3y ago
How to pass value to parameter that require IEnumable string [Answered]
C
C# / help
4y ago