समस्या की तरह कर सकते हैं आप एक switch
बयान में एक Color
उपयोग नहीं कर सकते है। sbyte
, byte
, short
, ushort
, int
, uint
, long
, ulong
, char
, string
: यह इन प्रकारों में से एक के लिए निम्न प्रकारों में से एक, प्रकारों में से एक के एक नल संस्करण, या या परिवर्तनीय होना चाहिए सी # भाषा कल्पना से, 8.7.2:
• Otherwise, exactly one user-defined implicit conversion (§6.4) must exist from the type of the switch expression to one of the following possible governing types: sbyte, byte, short, ushort, int, uint, long, ulong, char, string, or, a nullable type corresponding to one of those types.
आपके मामले में, आप इस के आसपास तार का उपयोग कर, या बस if
/else
विवरणों के एक सेट का उपयोग करके काम कर सकता था।
स्रोत
2013-08-16 17:20:09
'btn.BackColor' का प्रकार क्या है? – Floremin
जो एक बटन है। – NoviceToDotNet
मैं 'btn.BackColor' के प्रकार के बारे में पूछ रहा हूं, विशेष रूप से' btn' नहीं। – Floremin